Welcome to WebmasterWorld Guest from 22.214.171.124
I am new to Perl and can only start to get an understanding with maybe an example that explains how these concepts work.
Can anyone help me with this?
joined:Apr 25, 2002
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.