note 10287 deleted from function.eregi-replace by jimw

From: Date: Fri, 02 Nov 2001 02:06:20 +0000
Subject: note 10287 deleted from function.eregi-replace by jimw
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-20238@lists.php.net to get a copy of this message
I wrote a function to highlight these as url's: ftp://bruger@www.minhost.dk ftp://bruger:kodeord@www.minhost.dk http://www.minhost.dk/minside.php?id=1 http://www.minhost.dk/minside.php?id=1&bruger=mig Try this: Function validateURL ( $result ) { $result = eregi_replace("((ftp://)|(http://)|(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=\"\\0\" onfocus=\"blur()\">\\0</a>",$result); return $result; } $string = "a message that contains some url's"; $string = validateURL($string); echo $string;

« previous php.notes (#20238) next »