Don't ask to ask, just ask | |
PerlMonks |
Re: How to recognize url in text and convert to hyperlink, unless already in anchorby DrHyde (Prior) |
on Oct 12, 2004 at 08:51 UTC ( [id://398421]=note: print w/replies, xml ) | Need Help?? |
Do it in two stages. First unwrap any URLs that the user has already wrapped in <a ...> ... </a> tags. Then wrap all URLs in <a ...> ... </a> tags.
Alternatively, don't allow your users to put the tags in in the first place! This makes it easier to protect yourself and your users against craziness involving some of the other attributes of the <a> tag, like target, onclick and so on.
In Section
Seekers of Perl Wisdom
|
|