in reply to Regex: Lookahead

why so complicated?
$_ =~ http://www.google.com <a href="http://www.google.com">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.

print+qq(\L@{[ref\&@]}@{['@'x7^'!#2/"!4']});

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)