Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

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

by brycen (Monk)
on Oct 24, 2008 at 23:14 UTC ( #719454=note: print w/replies, xml ) Need Help??


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

Ok, I warmed up to this solution, thanks oshalla!
# pre build a pattern "foo\.edu|fum\.edu" my $what = join('|', map(quotemeta, keys %main::fixers)) ; sub tweak_links($) { my $text_ref = shift; return($$text_ref =~ s!(?<="http://)($what)(?=["/])!$main::fixers{$1}!ge); }
The overall script runtime dropped in half (0m4.8s vs. 0m7.2s on a test directory).

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (4)
As of 2022-12-05 08:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?