chuckdawit
06-28-2007, 05:40 PM
I have a string containing two url's separated by a <br/>. I would like to search through the string and replace/substitute the name in $sr with the same name in $string only in the color red and in bold. Here is what I'm trying:
my $sr = "2htec";
my $string = 'http://www.2htec.com <br/> http://www.2htec.com.cn';
while ($string =~ =~ m/$sr/gio) {
$string =~ s/$sr/"<font size='2' color='red'><b>" . $sr . "</font>"/gio;
}
print $string;
I can replace the string "$sr" with any string like cat, but I can't include the html. Any help with this would be appreciated. Thanks-Chuck
my $sr = "2htec";
my $string = 'http://www.2htec.com <br/> http://www.2htec.com.cn';
while ($string =~ =~ m/$sr/gio) {
$string =~ s/$sr/"<font size='2' color='red'><b>" . $sr . "</font>"/gio;
}
print $string;
I can replace the string "$sr" with any string like cat, but I can't include the html. Any help with this would be appreciated. Thanks-Chuck