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