That regex doesn't verify that the email addresses have a valid syntax in accordance with RFC 2822 like previously posted examples. It simply checks that they look like words with an @ sign in the middle. The (.|_) is pointless by the way. _ is covered by \w anyway, and . simply allows something like a dodgy octet.chandan wrote:uses this to validate ',' (comma) seperated email addresses. this regular expression not yet performance tuned, but should be good for validating emails.
Expression: ^(\w+(.|_)\w+@\w+\.\w+)(,(\w+(.|_)\w+@\w+\.\w+)|\S)+$
Dont forget to add escape sequence to suit to your env.
-Chandan Benjaram
The RFC2822 compliance thing I'm not too fussed about since I only check for ascii chars with an @ sign in the middle -- if the user doesn't get my email then they should specify a valid address. But the use of "." makes your validation vulnerable; depending upon it's usage.