note 14409 added to function.eregi-replace.php

From: Date: Mon, 30 Jul 2001 13:27:33 +0000
Subject: note 14409 added to function.eregi-replace.php
Groups: php.notes 
Request: Send a blank email to php-notes+get-16056@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...). http://www.php.net/manual/en/function.eregi-replace.php

« previous php.notes (#16056) next »