Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re3: Extended Regular Expressions

by Hofmator (Curate)
on Aug 16, 2001 at 19:40 UTC ( #105410=note: print w/replies, xml ) Need Help??

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

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://105410]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (8)
As of 2018-12-11 11:59 GMT
Find Nodes?
    Voting Booth?
    How many stories does it take before you've heard them all?

    Results (54 votes). Check out past polls.

    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!