in reply to Re^2: replace url in text with html link
in thread replace url in text with html link

Gee, I wonder why it works for me (works extremely well)
use URI; use URI::Find; use strict; use warnings; my $text = <<'__TEXT__'; Hi there, please read http://perlmonks.org/?node=How+to+RTFM. That's http://perlmonks.org/index.pl?node_id=78752. Students can activate their UMSIS userids on-line by filling out and submitting the form at https://umsis.miami.edu/sign-up. ...which can be obtained via the web at http://www.miami.edu/it-forms/ +. Holy snot http://batman.com, would you look at this!?!?! __TEXT__ find_uris($text, sub { my ($find_uri, $orig_uri) = @_; my $uri = URI->new( $orig_uri ); $uri = $uri->canonical->as_string; return '<a href="' . $uri . '">' . $uri . '</a>'; }); print $text; __END__ Hi there, please read <a href="http://perlmonks.org/?node=How+to+RTFM" +>http://perlmonks.org/?node=How+to+RTFM</a>. That's <a href="http://perlmonks.org/index.pl?node_id=78752">http://pe +rlmonks.org/index.pl?node_id=78752</a>. Students can activate their UMSIS userids on-line by filling out and submitting the form at <a href="https://umsis.miami.edu/sign-up">h +ttps://umsis.miami.edu/sign-up</a>. ...which can be obtained via the web at <a href="http://www.miami.edu/ +it-forms/">http://www.miami.edu/it-forms/</a>. Holy snot <a href="http://batman.com/">http://batman.com/</a>, would y +ou look at this!?!?!
Hi there, please read http://perlmonks.org/?node=How+to+RTFM. That's http://perlmonks.org/index.pl?node_id=78752. Students can activate their UMSIS userids on-line by filling out and submitting the form at https://umsis.miami.edu/sign-up. ...which can be obtained via the web at http://www.miami.edu/it-forms/. Holy snot http://batman.com/, would you look at this!?!?!
Must be lucky I guess :-)

update: for emails, try Email::Find (didn't see that coming)

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.