in reply to Re: Regex question
in thread Regex question

(?:[1-9]|1[0-9]|2[0-9]|3[01]) is a less simple replacement that would accept fewer invalid dates (e.g. you'd still match against 31st day of February; then again you'd want to do that validation further up the pipe anyhow).

Replies are listed 'Best First'.
Re^3: Regex question
by johngg (Canon) on Mar 22, 2007 at 15:17 UTC
    Another, lazier, way is to use an array and localize the default list separator

    @days = ( 1 .. 31 ); local $" = q{|}; m{(?:@days)};

    You'd probably want to limit the local $" inside a code block to avoid unexpected side effects elsewhere.

    Cheers,

    JohnGG