Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: converting user friendly regex to perl friendly

by abitkin (Monk)
on Oct 15, 2004 at 17:57 UTC ( [id://399592]=note: print w/replies, xml ) Need Help??


in reply to converting user friendly regex to perl friendly

Why convert it, when you can easily just change it to a set of if statements and eval that?

Note, completely untested code, written from memory

if($_ =~ s/\[(\d+)-(\d+)\]/){ s/\[(\d+)-(\d+)\]/command if(\$x >= $1 && \$x <= $2);/; eval $_; }
Most likely this code won't compile, but it's a starting point.

==
Kwyjibo. A big, dumb, balding North American ape. With no chin.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2024-03-29 12:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found