Home All Groups Group Topic Archive Search About
Author
9 Dec 2005 8:31 PM
sam
Hello,
We have a textbox on a web form (ASP.NET 2.0 - C#) that is for end-users to
enter e-mail address(es).  The valid entries are:

n***@company.com
na***@company.com;na***@company.com;na***@company.com (notice no space after
the semicolon)
na***@company.com; na***@company.com; na***@company.com (notice the space
after the semicolon)

Basically, the user can enter 1 e-mail address or more than 1 e-mail address
separated by a semicolon.

Can the RegularExpressionValidator control handle this situation?
If not, is there another way to validate this?

Thanks!

Author
11 Dec 2005 2:45 AM
agapeton
To avoid obfuscating the code, I would do this custom.  As in split on
all the e-mail separators (most people allow for space, camma,
semicolor, and new line) and then regexp against each.  If one fails,
they all fail.