.NETGURU
excluding characters...
Messages   Related Types
This message was discovered on ASPFriends.com 'aspng-validators' list.


Rel Breedlove
-- Moved from [aspregexp] to [aspng-validators] 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...
 
    
Kirk Jackson

It seems like you want to match so that all characters in the string
cannot be ':'

The bracket's let you define a set of characters that can match, e.g.
[a-z] or [12345]. If you put an ^ in the front, it will match anything
that is not one of the characters - e.g. [^a-z] will match any character
that is not between a and z (lowercase).

I believe the syntax for what you want is:

[^:]*

To list all three characters you'd do something like:

[^:;,]*

And adding slash in there may work as:

[^:;,/]*

Or you might have to escape the backslash:

[^:;,\/]*

Hope some of that's useful.

Kirk

-----Original Message-----
From: Rel Breedlove [mailto:Click here to reveal e-mail address]=20
Sent: Friday, 12 April 2002 3:21 a.m.
To: aspng-validators
Subject: [aspng-validators] excluding characters...

-- Moved from [aspregexp] to [aspng-validators] 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=3D"email" Text=3D"" size=3D"32" runat=3D"server" />
<asp:requiredFieldValidator id=3D"ValRequired1" runat=3D"server"
ControltoValidate=3D"email" Display=3D"dynamic">* You must enter an =
Email
Address.</asp:requiredFieldValidator>
<asp:RegularExpressionValidator id=3D"ValRequired2"
ControlToValidate=3D"email" Display=3D"Dynamic"
ValidationExpression=3D".+[@].+[.].+"
runat=3D"server"> <br>*Invalid Email Address
</asp:RegularExpressionValidator> <asp:RegularExpressionValidator
id=3D"ValRequired3" ControlToValidate=3D"email" Display=3D"Dynamic"
ValidationExpression=3D".+[^:].+"
runat=3D"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?

| [aspng-validators] member Click here to reveal e-mail address =3D YOUR ID=20
| http://www.aspfriends.com/aspfriends/aspng-validators.asp =3D =
JOIN/QUIT

Reply to this message...
 
    
lu
I could just kiss you!! I've been searching the internet all day trying to find this solution. THX!!!

--------------------------------
lu
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