.Net Regular expression - how to do an exact match exclusion on a full string?

Posted by Nathan Ridley on Stack Overflow See other posts from Stack Overflow or by Nathan Ridley
Published on 2010-04-12T10:47:27Z Indexed on 2010/04/12 11:03 UTC
Read the original article Hit count: 318

Filed under:
|

I need a .Net regular expression that matches anything OTHER than the exact full string match specified. So basically:

^Index$

... is the only exclusion I care about. Strings can start with, finish with or contain "Index", but not match exactly. My brain doesn't seem to be working today and I'm failing to work this one out.

EDIT

The answer MUST be via the pattern itself, as I am passing an argument to a third party library and do not have control over the process other than via the Regex pattern.

© Stack Overflow or respective owner

Related posts about .NET

Related posts about regex