Welcome to WebmasterWorld Guest from 18.104.22.168
a[^b] - matches "a" and whatever character follows an "a" as long as it's not a "b"
a(?!b) - matches "a" and only "a" provided that it is not followed by a "b" but it does not match the character after the "a".
So for example in "example" the first expression would capture "am" and the second would capture "a".
I'm trying to think of a case where you can't do it any other way, but I'm not coming up with one. You'll see, sometimes, that a negated character class won't get the job done though.