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

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

by brycen (Monk)
on Oct 24, 2008 at 22:47 UTC ( #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? | Other CB clients
Other Users?
Others contemplating the Monastery: (2)
As of 2022-12-10 08:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?