note 32039 deleted from function.preg-replace by sniper

From: Date: Sun, 07 Sep 2003 22:00:29 +0000
Subject: note 32039 deleted from function.preg-replace by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-55679@lists.php.net to get a copy of this message
Note Submitter: tripman@clubbing.pl ---- Once again, a bugfixed release of the mailto-link-maker. jomango's version treats ftp://login:pass@111.222.333.44/ as an emial address what is obviously wrong. my function looks like this: function makeLinks($text) { $search = array("/(?<!quot;|[=\"]|:\/{2})\b((\w+:\/{2}|www\.).+?)"." (?=\W*([<>\s]|$))/i", "/\b(^| )([\w\.]+)(@)([\w\.-]+)\b/i"); $replace = array("<a href=\"$1\">$1</a>", "<a href=\"mailto:$0\">$0</a>"); return preg_replace("/href=\"www/i", "href=\"http://www", preg_replace ($search, $replace, $text)); } Cheers, Rail

« previous php.notes (#55679) next »