There are two ways to say "do not match": character ranges and negative inverse mappings with zero width / lookbehind.
First: do not match a , b , c or 0 : [^a-c0]
Last: matches any three-letter string except foo and bar :
(?!foo|bar).{3}
or
.{3}(?<!foo|bar)
In addition, an amendment for you: * ? and + actually doesn't match anything. They are repetition operators and always follow the corresponding operator. Thus, a+ means the coincidence of one or more of a , [a-c0]+ means the coincidence of one or more of a , b , c or 0 , while [^a-c0]+ will correspond to one or more of all that there was no a , b , c or 0 .
Amadan May 08 '11 at 5:16 am 2011-05-08 05:16
source share