note 14409 deleted from function.eregi-replace by jimw
| From: | jimw@php.net | Date: | Fri, 02 Nov 2001 02:08:40 +0000 |
| Subject: | note 14409 deleted from function.eregi-replace by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-20247@lists.php.net to get a copy of this message | ||
OK, OK, I know, my previous note was a little wrong. But I've investigated many propositions
from other notes, and... (ooops, sorry guys) all of them are bugged(!).
My best shot is a combination of double use of eregi_replace() functions, so it's (it's a
little long):
$txt =
eregi_replace("(((ftp://)|(http://)|(mailto://))(([.][a-z0-9-])*)(@)?(([.][a-z0-9])*)(([:/])?)((([a-z0-9]*)(@?)/*)+([.][a-z]{2,4}){1})?((\??[a-z0-9=]*)?)(((\&[a-z0-9=]*))(([.][a-z]){2,4}))*)",
"<a href=\"\\0\">\\0</a>", $txt);
$txt =
eregi_replace("((www)(([.][a-z0-9-])+)(@)?(([.][a-z0-9])*)(([:/])?)((([a-z0-9]*)(@?)/*)+([.][a-z]{2,4}){1})?((\??[a-z0-9=]*)?)(((\&[a-z0-9=]*))(([.][a-z]){2,4}))*)",
"<a href=\"http://\\0\">\\0</a>",
$txt);
nice, huh?
Test this one and compare it to yours, maybe it's not the best shot (I'm sure that it
isn't...).