Subject: | Default regexp when no pattern has been added is misleading |
The default pattern returned by Regexp::Assemble when no pattern has
been added yet is a pattern that always fail (which is what everyone
should expect).
However, I was surprised to see that the following one-liner :
perl -MRegexp::Assemble -e 'print Regexp::Assemble->new->re'
returned
(?-xism:^a\bz)
And scratched my head for a while before realising it what doing
exactly what I expected.
Wouldn't (?!) be easier to read as a pattern that always fails?
(?-xism:(?!)) wouldn't have had me wonder what those 'a' and 'z' were.