note 79101 deleted from function.preg-replace by felipe
| From: | felipe@php.net | Date: | Sun, 23 Mar 2008 23:00:16 +0000 |
| Subject: | note 79101 deleted from function.preg-replace by felipe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-137401@lists.php.net to get a copy of this message | ||
Note Submitter: chad dot d dot john son at g mail dot com
----
I am very sorry...I made some mistakes with my previous post about mailto hyperlinks. I was not
adding back in the character which I removed from the beginning, and I also accounted for there
optionally being a subject, cc, bcc, and whatever else. Here is a corrected version:
$text = preg_replace(
"/([\s|\,\>])([a-zA-Z][a-zA-Z0-9\_\.\-]*[a-z" .
"A-Z]*\@[a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]{2,6}" .
"\??[A-Za-z0-9\!\@\#\$\%\^\&\*\(\)\_\-\=\+]*)" .
"([\s|\.|\,\<])/i",
"$1<a href=\"mailto:$2\">$2</a>$3",
$text);