Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: Mind boggling regex

by davis (Vicar)
on Oct 26, 2001 at 18:08 UTC ( [id://121631]=note: print w/replies, xml ) Need Help??


in reply to Mind boggling regex

The problem lies in that you're assuming that the \1 is going to contain the contents of the first set of parentheses. It won't.
In a character class, metacharacters etc take on a different meaning. I believe in this case the second set of parantheses is attempting to match 'any character that doesn't have octal code 001'
Remember, metacharacters take on a different meaning inside character classes.
I'm just off now to see if I can figure out an elegant solution to this one.
Update: 4 seconds later -- as ever, others have answered before me. japhy's solution is classier than I can attempt
/me wonders off to look up lookahead assertions properly.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-23 23:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found