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?

>>> [EMAIL PROTECTED] 07/02/02 01:50PM >>>
On Wednesday 03 July 2002 01:40, Martin Clifford wrote:
> Hey all!
> I'm trying to get this darn eregi_replace() to work, but it doesn't produce
> any results at all.
> I want it to find all occurances of PHP variables.  Here is the regexp
> $output = eregi_replace("^[\$]{1,2}[a-zA-Z][0-9]+$", "<b>\\1</b>", $var);
> As you might guess this is for a syntax highlighting function I am trying
> to write.  Anyone have any ideas why it's not working?  Please copy me
> directly, as I'm on the digest.  Thanks!

Your regex looks suspiciously like a PCRE!

Try changing eregi_replace to preg_replace.

Jason Wong -> Gremlins Associates -> www.gremlins.com.hk 
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

Reichel's Law:
        A body on vacation tends to remain on vacation unless acted upon by
        an outside force.

PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to