-4

I'm maintaining some c# software that contains a list of rules and each rule has a regex pattern as part of its definition. The regex pattern determines whether the rule should be applied to a particular data instance or not.

i.e. Given a particular string, apply the rule if the regex pattern matches against the string, but never apply the rule against strings that the regex pattern does not match.

I would like to deactivate some rules so that they never apply against any string.

So I need a regex pattern which does not match, no matter what string value is passed to it.

Any Suggestions?

ndnenkov
  • 33,260
  • 9
  • 67
  • 97
  • 3
    _"Any Suggestions?"_ - change your approach. In your "list of rules" just hold an `IsActive` boolean that you check. – CodeCaster Aug 19 '15 at 14:41
  • `"uSEtHISrEGEXpATTERN"` – Eser Aug 19 '15 at 14:43
  • Look this [answer](http://stackoverflow.com/a/1723225/4632606) – ZwoRmi Aug 19 '15 at 14:43
  • How do I transfer the -6 points I've earned from this question, to StackExchange's search authors? Knowing that it is taboo to ask an identical question, I searched through the first 3 pages of hits from a question search using my current title as the search criteria. I got back tons of answered questions about matching on nothing, but never saw the exact duplicate question which has since been identified. The duplicate question's title differed from my own, only in its past/present tense. Shouldn't it have appeared during my pre-question search? – Henry Taylor Aug 20 '15 at 20:55

1 Answers1

4

A negative lookahead that looks for nothingness to not follow the current position: (?!)

ndnenkov
  • 33,260
  • 9
  • 67
  • 97