kescott
Posts: 49
|
Posted: 09/03/2008, 12:55 PM |
|
I want to create a Regular Input Mask Validation for any email address that has .COM to it. But I don't want to allow anything with .NET
For example
Amy's email isamy@hello.com
Bill's email isbill@yes.net
Tim's email istim@nope.com
Now I will only allow Amy and Tim's email address to be entered. So this is what I came up with.
Regex mask = new Regex(@"^[\w\.-]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]\.com+$",
RegexOptions.IgnoreCase|RegexOptions.Multiline);
Also, what if I wanted to allow both .COM and .NET to be entered?
Regex mask = new Regex(@"^[\w\.-]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]\.com+
|^[\w\.-]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]\.com+|^[\w\.-]{1,}\
@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]\.com+|^[\w\.-]{1,}\
@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]
\.net+$",RegexOptions.IgnoreCase|RegexOptions.Multiline);
or maybe
Regex mask = new Regex(@"^[\w\.-]{1,}\@([\da-zA-Z-]{1,}\.){1,}[\da-zA-Z-]\
.com|net+$",RegexOptions.IgnoreCase|RegexOptions.Multiline);
_________________
B.S. of Computer Science
Class of 2005
Norfolk State University
Norfolk, VA
http://www.nsu.edu
|