Inverting a Regular Expression in Validator

S

spalding

One issue I've had is successfully searching for regular expression
documentation outlining the approach to inverting the test (ie.
returning true in the case that the expression is not found). Searching
google using keywords such as "invert", "not equal" or even "invalid
file extension" along with "regular expressions" do not seem to point
to any solid explanations/examples.

I would like to have used the regularexpressionvalidator simply for
it's ease of use (a one liner) but, as you say, CustomValidator would
be a suitable substitute.

Thanks for your prompt reply.
 
P

Peter Blum

I'm going to offer a different approach. It may seem radical at first but if
you investigate it carefully, I think you will see how it makes sense.

I rewrote ASP.NET validation to address its numerous limitations.
"Professional Validation And More" (http://www.peterblum.com/vam/home.aspx)
has 22 validators, including my version of the RegularExpressionValidator.
All of my validators introduce the property NotCondition. When true, it
reverses the logic. You would use it with your expression and get the
desired results.

I rewrote ASP.NET validation because Microsoft's design imposes some serious
limitations and simply isn't ready to handle a lot of common requests. Users
generally end up writing custom code and inventing hacks. I put together a
list of limitations here: http://www.peterblum.com/vam/valmain.aspx.
Hopefully it will help you better understand the tool you are presently
using and why it helps to switch to another.

--- Peter Blum
www.PeterBlum.com
Email: (e-mail address removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx
 

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,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top