CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> .NET

 Regular Input Validation Expression

Print topic Send  topic

Author Message
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
View profile  Send private message
kescott


Posts: 49
Posted: 09/09/2008, 10:42 AM

No luck yet. :(
_________________
B.S. of Computer Science
Class of 2005
Norfolk State University
Norfolk, VA
http://www.nsu.edu
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Web Database

Join thousands of Web developers who build Web applications with minimal coding.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.