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

Re: Mind boggling regex

by earthboundmisfit (Chaplain)
on Oct 26, 2001 at 18:05 UTC ( [id://121630]=note: print w/replies, xml ) Need Help??


in reply to Mind boggling regex

My uninformed guess is that it has to do with look ahead. If you hard code the 'e' it behaves as it should:
$word=~/(e)([^e])e/;
My understanding was that you could not use a reference to the matched result until after the pattern has matched.

I eagerly await the real answer from those who know

update: didn't have to wait long for that one. Should have practiced some look behind ;)

update2: As usual, I've confused my terminology. In studying japhy's answer it looks like I had the right idea, but really what it comes down to is that ([^\1]) is the wrong way to do a negative lookahead Pg. 203 of the Camel Book (3rd edition) offers a good explanation of this.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2024-04-25 19:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found