Is the only difference between ^
and \\A
the fact that \\A
can never match after a line break? (even in multi-line mode)
Yes. \A
will match at the very beginning of your value. ^
will match the beginning of the value, but will also match immediately after newlines in multiline mode (//m
).
The \Z
is similar, but with the end of the value. However, it will also match before a newline at the end of the value. If you don't want this behaviour, use \z
, which matches only at the end of the value.
Useful reference: perlre manpage