hmm, Just notice that, thanks..
I think,
.* and
.{0,} at the beginning of a regex pattern shold have been treated as optional, so that
/.*A/ and
/.{0,}A/ should be the same as
/A/ which means
.* and
.{0,} are completely unnecessary in the above patterns..
But
\z looks behave very differently to
.* and
.{0,} as you mentioned.
This looks like a Perl-related problem, PHP(use a similar regex engine) does it pretty well:
php -r '
$str = "foo\n";
if (preg_match("/.*\z/", $str)) {
print "match\n";
}
'
match
Probably it's a bug, and I am waiting for someone to make it clear. :-)
Regards,
Xicheng