note 79095 added to function.preg-replace

From: Date: Sat, 10 Nov 2007 20:58:19 +0000
Subject: note 79095 added to function.preg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-132170@lists.php.net to get a copy of this message
A little revision to Mac's email which replaces e-mail addresses with mailto hyperlinks. His version was not creating links out of email addresses surrounded by html tags (e.g. <b>joeschmoe@hotmail.com</b>). This new version could, however, create a problem if there are existing mailto links in the code. I obscure any existing mailto links first before running this. $text = preg_replace("/[\s|\,\>]([a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]*" . "\@[a-zA-Z][a-zA-Z0-9\_\.\-]*[a-zA-Z]{2,6})([\s|\.|\,\<])/i", " <a href=\"mailto:$1\">$1</a>$2", $text); ---- Server IP: 208.69.120.35 Probable Submitter: 69.149.249.215 ---- Manual Page -- http://www.php.net/manual/en/function.preg-replace.php Edit -- https://master.php.net/note/edit/79095 Del: integrated -- https://master.php.net/note/delete/79095/integrated Del: useless -- https://master.php.net/note/delete/79095/useless Del: bad code -- https://master.php.net/note/delete/79095/bad+code Del: spam -- https://master.php.net/note/delete/79095/spam Del: non-english -- https://master.php.net/note/delete/79095/non-english Del: in docs -- https://master.php.net/note/delete/79095/in+docs Del: other reasons-- https://master.php.net/note/delete/79095 Reject -- https://master.php.net/note/reject/79095 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#132170) next »