Surya sasidhar
Surya sasidhar

Reputation: 30293

Regular expression for multiple emails in ASP.Net

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:

"[email protected];[email protected];[email protected] "

How can I write a regular expression for this?

Upvotes: 0

Views: 1858

Answers (2)

o.k.w
o.k.w

Reputation: 25790

You can give this a try:

\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*([,;]\s*\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*)*

This is from RegexLib.com

Upvotes: 0

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798456

Start with the basic email regex and then apply as follows:

<email regex>(;<email regex>)*

Upvotes: 1

Related Questions