dynamic link converter

From: Date: Wed, 05 Mar 2003 20:49:21 +0000
Subject: dynamic link converter
Groups: php.general 
Request: Send a blank email to php-general+get-138360@lists.php.net to get a copy of this message
hi there i am trying tom preg_replace on a string enclosed in brackets to denote a dynamic link $message = "[http://www.eletroteque.dyndns.org/index_html.php|Eletroteque Multimedia]"; echo $message = preg_replace("/((http(s?):\/\/)|(www\.))([\w\.]+)([\/\w+\.]+)([\|\w+\.]+)\b/ i", "<a href=\"http\\3://\\4\\5\\6\" target=\"_blank\">\\7</a>", $message); the result would be |Electroteque , i need somehow to check for the stuff within the [ ] , remove the | and return on the two words Electroteque Multimedia for the second part of the replace any ideas ?

« previous php.general (#138360) next »