Hello, I have a certain string, say "foo bar widget" and would like to replace the substring "widget" with a link, so that:
foo bar widget
<becomes>
foo bar <a href="search.cgi?q=widget">widget</a>
Also - this needs to be case insensitive. Any ideas on how to get this done?
my $string = "foo bar wiDget"; $string =~ s|(widget)|<a href="search.cgi?q=$1">$1</a>|i; print $string;
Note, unless you know that all widgets are URL safe you will need to urlencode $1, something like:
use URI::Escape; my $string = "foo bar wiD get"; $string =~ s|(wid get)|'<a href="search.cgi?q='.uri_escape($1).'">$1</a>'|ie; print $string;
-- Simon Oliver
_______________________________________________ Perl-Win32-Web mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs