Inverting a Regular Expression in Validator

M

MWells

Interesting question;

1. there is probably a way in the regular expression itself to say
"anything that doesn't match this". I'd start there, check some regex
references for this.

2. you could use a custom validator and manually do the Regex test using
System.Text.RegularExpressions. If you get no match, you return success.

/// M
 
S

spalding

Hi

Does anyone know how to invert a regex in the
regularexpressionvalidator.

Example;

RegularExpresionValidator val = new RegularExpressionValidator();

val.ID = "val";
val.ValidationExpression = ".*.exe";


Now how do I get the validator to fail on the above expression? I have
looked high and low for an answer and cannot find one. I understand you
can invert a character sequence (eg. [^abc]) but how can you apply this
to the above?

Any advice (even if it's "YOU CAN'T DO THAT!!!") would be appreciated.
 

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,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top