"\n" =~ /\n.*\z/; # matches
Obvious, I think. You match a "\n", then EOS (end of string).
"\n" =~ /.*\z/; # doesn't match. i would expect it to match
perl -D512 tells anchored(MBOL) (i.e. multiline beginning of line, see perldebguts) with that one, which anchoring doesn't happen with
"\n" =~ /[^\n]*\z/; # matches. like expected. but [\n]* is like .*
but why?
"\n" =~ /.?\z/;
matches, as does
"\n" =~ /.{0,}\z/;
I can't get a mental model of why the previous one should, but the next one should not match:
"f\n" =~ /.?f\z/;
Weird. Rather inconsistent, if not buggy.
--shmem
_($_=" "x(1<<5)."?\n".q·/)Oo. G°\ /
/\_¯/(q /
---------------------------- \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}
|