in reply to url to html regex problem
Although that code is wrong. He needs to HTML-entitize the href parameter. Bleh. Here's the corrected code:Wrap each URI found in an HTML anchor. my $finder = URI::Find->new( sub { my($uri, $orig_uri) = @_; return qq|<a href="$uri">$orig_uri</ +a>|; }); $finder->find(\$text);
I just sent the author a bug report.use CGI qw(escapeHTML); my $finder = URI::Find->new( sub { my($uri, $orig_uri) = @_; $_ = escapeHTML("$_") for $uri, $ori +g_uri; return qq|<a href="$uri">$orig_uri</ +a>|; }); $finder->find(\$text);
-- Randal L. Schwartz, Perl hacker
|
|---|