note 42588 deleted from function.ereg-replace by tularis
| From: | tularis@php.net | Date: | Sun, 29 Aug 2004 12:11:37 +0000 |
| Subject: | note 42588 deleted from function.ereg-replace by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-75551@lists.php.net to get a copy of this message | ||
Note Submitter: php at yayel dot com
----
for hdn at umich dot edu :
I suggest to add regexp for anchors:
function html_activate_urls($str) {
// (...)
// Additional parameters (for GET)
$params = "[?][$vura]*";
// anchor; always begin with a letter
$anchor = "[#][[:alpha:]][[:alnum:]]*";
$str = eregi_replace(
"$protocol$server(/$path($name)?)?" .
"($params)?($anchor)?",
"<a href=\"\\0\">\\0</a>", $str); // URL into links
$str = str_replace("^^sentinal^^", '', $str);
return str_replace($search, $replace, $str);
}