perlre can:
\Z Match only at end of string, or before newline at the end
\z Match only at end of string
Update Consider:
my $str = "The quick abc"; for my $regex ('\babc\z', '\babc\Z') { print "Matched with newline using $regex\n" if "$str\n" =~ $regex; print "Matched without newline using $regex\n" if $str =~ $regex; }
Prints:
Matched without newline using \babc\z Matched with newline using \babc\Z Matched without newline using \babc\Z
In reply to Re: zero-width assertions in perl regular expression
by GrandFather
in thread zero-width assertions in perl regular expression
by leslie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |