Q:

Match multiple lines with multiline regex

I'm trying to match a text with multiple lines. My problem is that the line breaks can be different types (\n,\r\n or \r). Currently I'm using (?:\r?\n|\r) but wanted to replace it with $^ in multiline mode but it doesn't seem to work when they are not at the beginning or ending of a string.
For example A$^B does not match
A
B

A
B

I am using regex101 to test it.

A:

$ and ^ don't match the linebreak characters themselves, they only match the position at the end/start of a line. You need to use something like
A[\r\n]+B

