On Wednesday 03 July 2002 01:59, Martin Clifford wrote: > Even this: > > $output = preg_replace("/^[\$]{1,2}[a-zA-Z][0-9]+$/", "<b>\\1</b>", $var); > echo $output; > > Doesn't work. It just takes whatever you put into $var, then puts it into > $output, and outputs it to the screen. > > I want to change anything resembling a PHP variable, i.e. $var, $$var or > &$var to <b>$var</b>. Any ideas on how to do that?
Don't use "" strings unless you need variable expansion. Try: '/^\${1,2}[ .... ... actually try RTFM, the section on variables gives you a regex definition of acceptable PHP variables! -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* To be sure of hitting the target, shoot first and, whatever you hit, call it the target. */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php