Validator

  • Thread starter Thread starter win
  • Start date Start date
W

win

I am using a RegularExpressionValidator and the ValidationExpression is
"/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/"

It still have errorMessage.

Can anyone help me?

Thanks
 
win said:
I am using a RegularExpressionValidator and the ValidationExpression is
"/^\d{1,2}(\-|\/|\.)\d{1,2}\1\d{4}$/"

It still have errorMessage.

Can anyone help me?

Thanks

You probably don't want the "/" at the beginning and end: they would be
interpreted as literal "/" characters to match against, NOT regex
delimiters.
Also you don't need the ^ and $ here: the RegexValidator checks that the
entire string matches (as opposed to only a substring).

Hans Kesting
 
Hi Win,

As for the regular expression error, do you mean that the ASP.NET page will
raise exception when you try running the page that contains the regular
expressioni validator? Or you means the validator control will display
validation error?

For syntax of regex in ASP.NET context, you can refer to the following
articles:

#How To: Use Regular Expressions to Constrain Input in ASP.NET
http://msdn.microsoft.com/en-us/library/ms998267.aspx

#Regular Expressions in ASP.NET
http://msdn.microsoft.com/en-us/library/ms972966.aspx#regexnet_topic9

BTW, the regulator is a good regex tool built with .NET framework, I think
it will be helpful when we editing regex that will be used in .net
application:

http://sourceforge.net/projects/regulator

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.


--------------------
 
Hi Win,

Have you got any progress on this issue? If you need any other help,
welcome to post here.

Sincerely,

Steven Cheng

Microsoft MSDN Online Support Lead


Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
Content-Transfer-Encoding: 7bit
From: (e-mail address removed) (Steven Cheng [MSFT])
Organization: Microsoft
Date: Thu, 22 May 2008 03:04:17 GMT
Subject: RE: Validator
 
Back
Top