Search:
Namespaces
Discussions
.NET v1.1
Feedback
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
Ad
MBR BootFX
Best-of-breed application framework for .NET projects, developed by Matthew Baxter-Reynolds and MBR IT
Copyright © Matthew Baxter-Reynolds 2001-2008. '.NET 247 Software Development Services' is a trading style of MBR IT Solutions Ltd.
Contact Us
-
Terms of Use
-
Privacy Policy
-
www.dotnet247.com