[lug] regex question

charles at lunarmedia.net charles at lunarmedia.net
Wed Jun 27 08:51:20 MDT 2001


i'd like to test to see if a variable has two \@ symbols, and i am
struggling with the best way to do so. i am sure the format of the string
will be

foo at bar.com foo at baz.com

where the empty space between the two addresses could be any one or two
characters. so far, i have come up with

/^(\w)+\@(\w)+\.(\w)+(.|..)(\w)+/@/

but i am not certain if this is very efficient. i only test up to the
second @ in my regex which i think is sufficient to verify whether or not
the string has two @ symbols

is there a better way to do this?





More information about the LUG mailing list