RegularExpressionValidator Issues

J

John Yopp

I'm trying to use a asp:RegularExpressionValidator to validate the
strength of a password. When I test the regular expression with
Regex.IsMatch, it works perfectly. However, when used within a
RegularExpressionValidator, it always returns false.

Has anyone else had issues with the RegularExpressionValidator not
correctly parsing a regular expression?

The regular expression I am using is:
"^.*(?=.*\d)|(?=.*[^a-zA-Z0-9])|(?=.*[A-Z])(?=.*[a-z])(?=.{8,}).*$"

Thanks
 
S

S. Justin Gengo

John,

I'm not 100% positive about this, but if I'm thinking clearly try removing
the caret "^" at the beginning of your regular expression and the dollar
sign "$" at the end. I believe they are needed when using Regex.IsMatch, but
I believe that the RegularExpressionValidator adds them for you.

Let us know if that was it...

Regards,

--
S. Justin Gengo
Web Developer / Programmer

Free code library:
http://www.aboutfortunate.com

"Out of chaos comes order."
Nietzsche
 

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

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,219
Latest member
KristieKoh

Latest Threads

Top