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

Re: Regex: Lookahead

by codeacrobat (Chaplain)
on May 11, 2009 at 22:54 UTC ( #763381=note: print w/replies, xml ) Need Help??

in reply to Regex: Lookahead

why so complicated?
$_ =~ <a href="">fail a match here</a> ~; s#^(http://\S+)#<a href="$1">$1</a>#gmsi; print;
Whatever multiline matching you are trying to do the you should use the /m flag.


Replies are listed 'Best First'.
Re^2: Regex: Lookahead
by Rodster001 (Pilgrim) on May 12, 2009 at 15:35 UTC
    Except that it doesn't work. Because your example is doing the replacement on the second line (like mine). I need it to fail the replacement on the second line (because it already is an html link).
      Did you run it? (Change "$_ =~" to "$_ = q~" first.) It may not do what you want, but contrary to what you claim, it doesn't touch the second line. (Note the /^/m)

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (5)
As of 2021-09-19 08:27 GMT
Find Nodes?
    Voting Booth?

    No recent polls found