in reply to Simple Regex for Alpha string

Note that "AB\n" will pass your test. This is often a nice convenience, but you can use /^[A-Z]{2}\z/ to disallow trailing newlines.

        - tye (but my friends call me "Tye")

Replies are listed 'Best First'.
Re: (tye)Re: Simple Regex for Alpha string
by jlongino (Parson) on Nov 14, 2001 at 02:13 UTC
    That would not be good in this case, but fortunately I think the string that is tested is chomped earlier in the program. But this is something really good to know and could probably drive a regex novice insane during the debugging process. Thanks!

    --Jim