http://www.perlmonks.org?node_id=105410


in reply to Re: Re: Extended Regular Expressions
in thread Extended Regular Expressions

Ok, the problem with [^\z] can be easily seen when you use warnings - which is a good idea in general. Perl complains then about an unidentified escape sequence in the character class. This means that \z is not the end of the string in a character class!! All metacharacters loose their special meaning in a character class.

So [^\z] is equivalent to [^z] which is a single character that is not a 'z'. Looking at your original regex print $& if /^<a href.*>(?=[^\z])/x; Consequently the .* in your regex eats up everything till the last '>' and checks if the next character is not a z. Which is true, as it is a newline. Ergo, match found, mystery solved :)

-- Hofmator