note 79593 deleted from function.preg-replace by felipe
| From: | felipe@php.net | Date: | Mon, 10 Dec 2007 02:05:06 +0000 |
| Subject: | note 79593 deleted from function.preg-replace by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133085@lists.php.net to get a copy of this message | ||
Note Submitter: erik at teshack dot com
----
I further refined the regular expression to support underscores in the URL as well as support a
string that ends in a parenthesis, for example, (see: http://www.php.net)
$content_text = preg_replace("/[^<> ]([a-zA-Z]
+:\/\/[a-z][a-z0-9\_\.\-]*[a-z]{2,6}[a-zA-Z0-9\/
\*\_\.\-\?\&\%\=]*)([^\s|\)|\.|\,<])/i",'<a href=
"$0" target="_blank">$0</a>',$content_text);