how to avoid double URL parsing
| From: | indrek siitan | Date: | Wed, 03 Jan 2001 13:25:13 +0000 |
| Subject: | how to avoid double URL parsing | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-32485@lists.php.net to get a copy of this message | ||
Hi,
ok, it probably might be a dumb question, but since I'm tied up
with other things right now, I hope someone has invented that
wheel already :)
in the function, that prepares an article body for outputting
to the page, I have the following function to make links clickable:
$c=ereg_replace("http://(([A-Za-z0-9.\-])+)([a-zA-Z0-9])((/(([a-zA-Z0-9])*))*)((
.([a-zA-Z0-9])+)*)", "<A TARGET=\"_blank\"
HREF=\"\\0\">\\0</A>",$c);
now, does anyone have an idea how to extend that to handle situations
where user has its own HTML links (<a href="http://blah">blah</a>)
inside the $c - currently, as you might expect, it screws 'em up.
Rgds,
Indrek
---------------------------------------------------------------------------
Indrek Siitan, CEO eMotion Ltd. [http://www.eMotion.ee]
e-mail: tfr@eMotion.ee Narva mnt 31, 10120 Tallinn Estonia
cellular: +372 50 17621 phone: +372 6605 890