my $text = qq~ http://www.google.com fail a match here ~; $text =~ s#(http://[^\s]*)(?!["|<])#$1#gsi; print $text;