Search:
Namespaces
Discussions
.NET v1.1
Feedback
Searching for "Strings"...not working in ASP.NET RegularExpressionValidator
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.
George Pagotelis
I went to
http://regexlib.com/RETester.aspx
And I typed the expression "foo$" to test against
"nec.com.foo" SUCCESS!
Now I try this and it will not work in my asp.net!
I just want to be able to search for strings. Preferably
that aren't attached to the end of the expression. There
are NO spaces at the end as I've checked. I basically
really want "nec\.com\.au" case-insensitive matching.
If somebody could test this for me and tell me if it works for them I'd
appreciate something that works!
thanks,
GP
<asp:TextBox id="txtEmailAddress" runat="server" columns="60"
text=
Click here to reveal e-mail address
/>
<asp:RegularExpressionValidator id="valValidEmail1" runat="server"
ControlToValidate="txtEmailAddress"
ValidationExpression="^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[
0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$"
ErrorMessage="You must enter a valid Email address"
Display="None">
</asp:RegularExpressionValidator>
<asp:RegularExpressionValidator id="valValidEmail2" runat="server"
ControlToValidate="txtEmailAddress"
ValidationExpression="foo$"
ErrorMessage="No foo!"
Display="None">
</asp:RegularExpressionValidator>
Reply to this message...
Steven A Smith (VIP)
The
RegularExpressionValidator
ignores assumes ^ and $. So your expression
is the same as ^foo$$, which is only going to match 'foo'.
To make it match anything ending with foo, you probably need something like
.*foo which will turn into ^.*foo$.
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://amazon.com/exec/obidos/ASIN/0789725622/stevenatorasp/
----- Original Message -----
From: "George Pagotelis" <
Click here to reveal e-mail address
>
To: "aspngregexp" <
Click here to reveal e-mail address
>
Sent: Thursday, June 06, 2002 2:38 AM
Subject: [aspngregexp] Searching for "Strings"...not working in ASP.NET
RegularExpressionValidator
[Original message clipped]
Reply to this message...
System.Web.UI.MobileControls.RegularExpressionValidator
System.Web.UI.MobileControls.TextBox
System.Web.UI.WebControls.RegularExpressionValidator
System.Web.UI.WebControls.TextBox
System.Windows.Forms.TextBox
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