in reply to How to recognize url in text and convert to hyperlink, unless already in anchor
All you need to do is look for the links as you are doing, but make sure that the links are preceeded, and optionally followed, by whitespace.
This will never by true for something inside an A tag.
(Yes the real solution is to use a package from CPAN for recognising URLS, and parsing, but this is a hack on your hack).
You could use the following:
$myformtext =~ s!(\s)(http://\w.*?)(\s)!$1<a href="$2">$2</a>$3!gm;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: How to recognize url in text and convert to hyperlink, unless already in anchor
by tachyon (Chancellor) on Oct 12, 2004 at 06:31 UTC |
In Section
Seekers of Perl Wisdom