in reply to Matching date range with pure regex

Try  /^(19[5-9]\d)|(20([0-4]\d)|50)$/

Replies are listed 'Best First'.
Re: Re: Matching date range with pure regex
by dragonchild (Archbishop) on Feb 18, 2004 at 01:47 UTC
    You need to add an outermost set of parentheses. /^((19[5-9]\d)|(20(([0-4]\d)|50)))$/

    I don't know why, but I'm always paranoid when using | in a regex, primarily because I don't know exactly how it works. (I need to read Mastering Regular Expressions, I know ...)

    ------
    We are the carpenters and bricklayers of the Information Age.

    Please remember that I'm crufty and crochety. All opinions are purely mine and all code is untested, unless otherwise specified.