regex help
| From: | Gerard Samuel | Date: | Mon, 02 Sep 2002 03:10:40 +0000 |
| Subject: | regex help | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-114867@lists.php.net to get a copy of this message | ||
Im trying to apply htmlspecialchars() to hrefs in a string.
Here is what I have.
------------------------
<?php
$str = 'hi <b>my friend</b>! <br /> this message uses html entities <a href="http://www.trini0.org">test</a>!';
$str = preg_replace('/(<a href="http:\/\/.*">.*<\/a>)/', htmlspecialchars("$1"), $str);
print($str);
?>
Any help would be appreciated.
Thanks
--
Gerard Samuel
http://www.trini0.org:81/
http://dev.trini0.org:81/