Filtering URLs problem..
| From: | Anders Norrbring | Date: | Tue, 20 Dec 2005 13:46:33 +0000 |
| Subject: | Filtering URLs problem.. | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-227713@lists.php.net to get a copy of this message | ||
I'm writing a filter/parsing function for texts entered by users, and I've run into a problem...
What I'm trying to do is to parse URLs of different sorts, ftp, http, mms, irc etc and format them as links, that part was real easy..
The hard part is when a user has already entered a complete link..
In short:
http://www.server.tld/page.html
should be converted to:
<a href='http://www.server.tld/page.html'>http://www.server.tld/page.html</a>
That part works fine, but if the user enters:
<a href='http://www.server.tld/page.html'>click here</a>
it all becomes a mess... Can somebody please make a suggestion on this?
--
Anders Norrbring
Norrbring Consulting