in reply to Re^2: When exactly do Perl regex's require a full match on a string?
in thread When exactly do Perl regex's require a full match on a string?
A regex like /\n$\n/ doesn't really make any sense since matching after the end of the string is like asking for the 11th value of a 10 value array. So whether it matches "\n\n" is quite academic. I could live with a perl that does not have a consistent answer for this. The important cases IMO are:
> perl -e ' $_="a\n"; print "match\n" if (m/^a\n$/); ' match > perl -e ' $_="a\n"; print "match\n" if (m/^a$/); ' match
Which means you can match the \n if you want, but you don't need to.
|
|---|