***URGENT REGEXP: Am I missing something?

From: Date: Fri, 15 Sep 2000 01:10:57 +0000
Subject: ***URGENT REGEXP: Am I missing something?
Groups: php.general 
Request: Send a blank email to php-general+get-16876@lists.php.net to get a copy of this message
Hi guys, I am trying to write a PowerDynamo to PHP convertor (I know, I know) and I am having some troubles with regular expressions. What I am trying to do is seperate every 'token' by spaces. So: a==a; Would become: a = = a ; Then I can split the file into an array and parse it. The problem is, I need to keep compound operators intact, so: a==a; Would become: a == a ; I can do the above quite easily with ereg_replace("==", " == ", $line); The problem arises when I try to then go through and seperate all the *single '=' signs. If I use ereg_replace("=", " = ", $line), I get: a = = a ; BUT then if I go ereg_replace("= =", " == ", $line); I get no joy. I tried "\= \=", "=[ ]=", "=\s=", but nothing happens. The curious thing is, if I do ereg_replace("else if", "elseif", $line); it does that fine. So what's wrong with replacing '=' signs? Are they meta characters? Is ereg_replace broken? Thanks for any help. Regards, Tyson Lloyd Thwaites IT&e Ltd

« previous php.general (#16876) next »