1. Perl
  2. Regular expression
  3. here

Match to the end of the string - \z

Use \z to represent the end of a string with a regular expression.

The difference from "$" is that the meaning does not change even if you use the m option. When using the m option, the "$" now represents the end of the line instead of the end of the string.

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

Related Informatrion