in reply to Re: Regular Expression Question
in thread Regular Expression Question

Thanks for your help. Why is there a "!" in front of the 1st regexp ? I understand the 2nd.

Replies are listed 'Best First'.
Re: Re: Re: Regular Expression Question
by nevyn (Monk) on Dec 04, 2003 at 20:25 UTC
    The character class is negated, note where the ^ is...
    ! /[^a-zA-Z0-9,]/
    ...however I'm not sure the double negative is faster enough to warrant not just doing the more obvious...
    /^[a-zA-Z0-9,]+$/
    ...it's also not stated whether /^$/ is valid or not, which is different for the above two.
    --
    James Antill