Regular expressions CANNOT match “newline” sequences at the end of a line. Therefore, the expression [^a] matches any character, except for “a” and a “newline” (single Line-Feed or Carriage-Return and Line-Feed). Similarly, the *, + and ? operators stop matching when they reach the “newline” characters.

[\h00-\h1f]
Matches any control characters, except “newline”.
a.*
Matches the letter “a” and all following characters up to, but not including, the “newline” characters.

The only exception to this is “\N” which explicitly matches the “newline” character(s).

end\Nbegin
Match “end” at the end of a line, followed by “begin” at the beginning of the next line.

Related Resources