Regex textbox length validator.

D

darrel

I'm trying to validate the length of characters in a text box. Google seems
to turn up a few examples of using the regex validator with this expression:

^[\S\s]{1, 50}$

(one being minimum length, 50 being maximum).

However, on my page, no matter the length, this validator is always coming
up as invalid. Is the expression incorrect?

-Darrel
 
?

=?ISO-8859-1?Q?G=F6ran_Andersson?=

The ^ and $ shouldn't be used in a RegularExpressionValidator. The space
in the quantifier might be a problem also.

[\S\s]{1,50}
 
C

Cowboy \(Gregory A. Beamer\)

ValidationExpression="[\S\s]{10,50}"



Can also be

ValidationExpression="[\w\s]{10,50}" - word or whitespace



The second is actually better, as it gets rid of garbage. Unlikely someone
can type the garbage in, however, so the risk is not high either way.


--
Gregory A. Beamer

*************************************************
Think Outside the Box!
*************************************************
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top