Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Inverting a Regular Expression in Validator

Reply
Thread Tools

Inverting a Regular Expression in Validator

 
 
spalding
Guest
Posts: n/a
 
      01-28-2005

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.



--
spalding
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------

 
Reply With Quote
 
 
 
 
Peter Blum
Guest
Posts: n/a
 
      01-28-2005
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: http://www.velocityreviews.com/forums/(E-Mail Removed)
Creator of "Professional Validation And More" at
http://www.peterblum.com/vam/home.aspx

"spalding" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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.
>
>
>
> --
> spalding
> ------------------------------------------------------------------------
> Posted via http://www.codecomments.com
> ------------------------------------------------------------------------
>



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Inverting a regular expression? Harry Ohlsen Ruby 8 05-03-2005 12:21 AM
Inverting a Regular Expression in Validator MWells ASP .Net 1 01-28-2005 02:44 AM
Regular Expression Validator Bryce Budd ASP .Net 1 09-18-2003 05:51 PM
Dynamically changing the regular expression of Regular Expression validator VSK ASP .Net 2 08-24-2003 02:47 PM
Re: howto use c# regular expression validator to exclude file types Brian Vallelunga ASP .Net 2 07-31-2003 10:27 PM



Advertisments