in reply to Re: Generate list from a to arbitrary letter
in thread [Solved] Generate list from a to arbitrary letter

... a value that is not the empty string and matches the pattern  /^[a-zA-Z]*[0-9]*\z/ ...

This part of the documentation is confusing to me because the empty string matches the pattern:

>perl -wMstrict -le "$_ = ''; print 'match' if /^[a-zA-Z]*[0-9]*\z/; " match

I'm sure I've seen a discussion of this point, but I cannot lay my hands on it at the moment. Anyone...?

Replies are listed 'Best First'.
Re^3: Generate list from a to arbitrary letter
by Eily (Monsignor) on Nov 21, 2013 at 00:42 UTC

    Well, there would be no point making two test if the result of one was the subset of the other (for exemple "a value that is positive and greater than 10"). In Perl, this condition would actually be: $matches if $_ ne '' and /^[a-zA-Z]*[0-9]*\z/ this was probably to have something easier to understand than one of those two patterns:

    /^(?: [a-zA-Z]+ [0-9]* | [a-zA-Z]* [0-9]+ ) \z/x; /^(?=.)[a-zA-Z]*[0-9]*\z/;
    The first one being a bit long, and the second not so beginner friendly.