in reply to Regexp: Match anything except a certain word

The following seems to work:
$_ = join '', <DATA>; s/(<a href="https?:\/\/(?:(?!target=).)*?)>/$1 target="_blank">/igs; print; __DATA__ <a href="dsfsdf">sdfdsf</a> <a href="http://dsfsdf">sdfdsf</a> <a href="https://dsfsdf">sdfdsf</a> <a href="http://dsfsdf" target="_blank">sdfdsf</a> <a href="http://dsfsdf" >sdfdsf</a>

Replies are listed 'Best First'.
Re^2: Regexp: Match anything except a certain word
by ikegami (Patriarch) on Apr 21, 2006 at 19:23 UTC

    You're assuming the target will come after the href, but the OP allowed for any order.

    See my earlier post for the fix.