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!