1. Perl
  2. Regular expression
  3. here

Match to the beginning of the string - \A

Use \A to represent the beginning of a string with a regular expression.

# Beginning of string
\A

The difference from "^" is that the meaning does not change even when the m option is used. When the m option is used, "^" will represent the beginning of the line instead of the beginning of the string.

my $str = "abc\ndef";
if ($str =~ /\Acat/m) {
  # Match to the beginning of the string
}

Related Informatrion