Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Insert text in a string

by giulienk (Curate)
on Jan 18, 2002 at 15:37 UTC ( [id://139798]=note: print w/replies, xml ) Need Help??


in reply to Insert text in a string

You could also take a regexp approach:
$_ = 'href=www.perlmonks.org'; s!href=!href=http://!gi;

$|=$_="1g2i1u1l2i4e2n0k",map{print"\7",chop;select$,,$,,$,,$_/7}m{..}g

Replies are listed 'Best First'.
Re: Re: Insert text in a string
by blakem (Monsignor) on Jan 19, 2002 at 00:25 UTC
    At the very least, you should use a look-ahead to avoid prefixing 'http://' to strings that already have one...
    s|href=(?!http://)|href=http://|gi;

    -Blake

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (6)
As of 2024-04-24 09:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found