1
Vote

Extension Method :: AndNot()

description

Proposing the ability to add a negating logic statement as a regular expression extension method
 
Consider the following usage:
Regex areaCode = new Regex("\d{3}").AndNot("911");     // Describes a regex that is a basic character range except for a single exclusion
 
Problem:
This issue is not a problem in Java, which would represent the above regex as:
@"[\d{3}&&[^911]]"
... however, the && logic concatination is not available in .NET. Therefore, what option do we have other than describing a range from 0-910 and 912-999?

comments