note 79311 deleted from function.preg-replace by felipe
| From: | felipe@php.net | Date: | Mon, 10 Dec 2007 02:06:16 +0000 |
| Subject: | note 79311 deleted from function.preg-replace by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-133086@lists.php.net to get a copy of this message | ||
Note Submitter: radubuzoianu at yahoo dot com
----
$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>',$text);
$text = preg_replace("/(\s)(www\.[a-z][a-z0-9\_\.\-]*[a-z]{2,6}
[a-zA-Z0-9\/\*\-\?\&\%\=]*)/i",
'$1<a href="http://$2"
target="_blank">$2</a>',$text);
Your example didn't work...
This is what i've changed and now works fine
NOTE: also remove whitespaces (enter, space) from expression, if any