In my application I validate emails; but we can give more than one email address separated with a semicolon (";"). How can I write the validation expression?
My emails look like this:
"sasidhar@yahoo.com;suryasasidhar@开发者_高级运维gmail.com;srinivas@gmail.com "
How can I write a regular expression for this?
Start with the basic email regex and then apply as follows:
<email regex>(;<email regex>)*
You can give this a try:
\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*([,;]\s*\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)*
This is from RegexLib.com
精彩评论