.NETGURU
excluding characters...
Messages   Related Types
This message was discovered on ASPFriends.com 'aspngregexp' list.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.

Rel Breedlove
-- Moved from [aspregexp] to [aspngregexp] by Charles M. Carroll <Click here to reveal e-mail address> --

Hi All,

I am writing validation for an email address. First off, i want to make sure
there isn't a problem using 2 RegularExpressionValidator's for one field....

Other than that this is what I have, the first works fine, but the second,
where I'm trying to exclude ":", I can't figure out the syntax....

<ASP:textbox id="email" Text="" size="32" runat="server" />
<asp:requiredFieldValidator id="ValRequired1" runat="server"
ControltoValidate="email" Display="dynamic">* You must enter an Email
Address.</asp:requiredFieldValidator>
<asp:RegularExpressionValidator id="ValRequired2" ControlToValidate="email"
Display="Dynamic"
ValidationExpression=".+[@].+[.].+"
runat="server"> <br>*Invalid Email Address
</asp:RegularExpressionValidator>
<asp:RegularExpressionValidator id="ValRequired3" ControlToValidate="email"
Display="Dynamic"
ValidationExpression=".+[^:].+"
runat="server"> <br>*Can Not Contain /:,;
</asp:RegularExpressionValidator>

I have also tried...
".*[^:].*"
"[^:]"
"[^\:]"

Thanks
Rel

PS> my next step will to be sure to exclude "/", ";" and ","

how do you exculde more than 1 character with 1 expression?

Reply to this message...
 
    
Steven A Smith (VIP)
1. You can use as many validators of any type for a given ControlToValidate
as you like.
2. There are several excellent email validation expressions that actually
validate to the email RFC standard at http://regexlib.com/, so if you're not
doing this as a personal exercise to learn regular expressions, you might
look there.

Steve

Steven Smith, MCSE+Internet, Microsoft MVP: ASP.NET
Click here to reveal e-mail address
President, ASPAlliance.com
http://aspalliance.com The #1 ASP.NET Community
http://aspsmith.com ASP.NET Training for ASP Developers

Learning ASP.NET? Get My Book: ASP.NET By Example
http://www.amazon.com/exec/obidos/ASIN/0789725622/stevenatorasp/
----- Original Message -----
From: "Rel Breedlove" <Click here to reveal e-mail address>
To: "aspngregexp" <Click here to reveal e-mail address>
Sent: Thursday, April 11, 2002 11:20 AM
Subject: [aspngregexp] excluding characters...

> -- Moved from [aspregexp] to [aspngregexp] by Charles M. Carroll
<Click here to reveal e-mail address> --
[Original message clipped]

Reply to this message...
 
 
System.Web.UI.MobileControls.RegularExpressionValidator
System.Web.UI.WebControls.RegularExpressionValidator




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification