s/href=([^"\s>]+)/href="$1"/g #### Google uses .html files. #### s/(href="[^"]*)\.html"/$1.asp"/g s/(href="http://[^"]*)\.asp"/$1.html"/g #### s{(href="[^"]*\.html")}{ my $s= $1; $s =~ s#\.html"$#.asp"# unless $s =~ m#^http:#; $s }ge;