note 16055 deleted from function.ereg-replace by jimw

From: Date: Fri, 02 Nov 2001 02:00:11 +0000
Subject: note 16055 deleted from function.ereg-replace by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-20222@lists.php.net to get a copy of this message
The above link functions affect existing urls inside html thats already in the string, this leaves existing urls (eg in an IMG tag) untouched function node_parse_text ( $text ) { $text = ereg_replace("((www.)([a-zA-Z0-9@:%_.~#-\?&]+[a-zA-Z0-9@:%_~#\?&/]))", "http://\\1", $text); $text = ereg_replace("((ftp://|http://|https://){2})([a-zA-Z0-9@:%_.~#-\?&]+[a-zA-Z0-9@:%_~#\?&/])", "http://\\3", $text); $text = ereg_replace("(((ftp://|http://|https://){1})[a-zA-Z0-9@:%_.~#-\?&]+[a-zA-Z0-9@:%_~#\?&/])", "<a href=\"\\1\">\\1</a>", $text); $text = ereg_replace("((<a href=\"<a href=\")(((ftp://|http://|https://){1})[a-zA-Z0-9@:%_.~#-\?&]+[a-zA-Z0-9@:%_~#\?&/]\">))((((ftp://|http://|https://)([a-zA-Z0-9@:%_.~#-\?&]+[a-zA-Z0-9@:%_~#\?&/]))))(</a>\">)", "<a href=\"\\6\">", $text); $text = ereg_replace("([_\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\.)+[a-z]{2,3})","<a href=\"mailto:\\1\">\\1</a>", $text); return $text; }

« previous php.notes (#20222) next »