Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Replace after match in regex (key value subsitution)

by brycen (Monk)
on Oct 24, 2008 at 22:47 UTC ( [id://719452]=note: print w/replies, xml ) Need Help??


in reply to Replace after match in regex (key value subsitution)

I ended up going with this, because, well, clarity of code won over speed?
sub tweak_links($) { my $text_ref = shift; my $modified = 0; while (my($key,$value) = each(%main::fixers)) { if($$text_ref =~ s|"(http://)$key(["/])|"$1$value$2|g) { #" $modified = 1; } } return($modified); }
I'd prefer a pre-compiled regex, if the resulting code was not obtuse.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-03-28 16:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found