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

Re: Deregex

by Arien (Pilgrim)
on Aug 30, 2002 at 23:00 UTC ( [id://194270]=note: print w/replies, xml ) Need Help??


in reply to Deregex

You're missing a $ in my (regex) = @_. Also, you can qr// an empty string, which will break your regex.

Simplifying and enhancing a bit more results in something like:

sub deregex { my $regex = shift; my ($ops, $pat) = $regex =~ /^\(\? ([msix-]+) : (.*) \)$/x or die "Unknown qr// format"; $pat =~ s!/!\\/!g; $ops =~ s/-.*//; return "/$pat/$ops"; }

— Arien

Replies are listed 'Best First'.
Re: Re: Deregex
by Dylan (Monk) on Aug 30, 2002 at 23:36 UTC
    Oopsy. I must've removed it when I removed the $self, from it (It was a method). Thanks a lot!

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (2)
As of 2025-02-09 01:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which URL do you most often use to access this site?












    Results (95 votes). Check out past polls.