On Wed, 2004-02-04 at 16:35, Sam Masiello wrote:
> Thank you for the reply, Adam, but unfortunately it didn't work.

Sorry bout that.  Here's another shot at it.

If I understand your goal correctly you want to escape the existing
backslashes that proceed certain special characters (namely
[:alpha:]+*/.|<>()$).  That works fine so far,  but you want to add the
[ and ] characters to the list I am guessing.  Here is one way you could
do it:
$rule = ereg_replace("\\\\[[:alpha:]+*/.|<>()$[\[]", "\\\\0", $rule);

That turns this:
a\a\+\-\*\[\{\<\|

into this:
a\\a\\+\-\\*\\[\{\\<\\|

However, you will have a problem if there are double escaped characters,
or characters that are escaped but on in your list.  I suggest doing
this:
$rule = ereg_replace("\\\\", "\\\\", $rule);

This turns this:
a\a\+\-\*\\a+\\-\\*\\a\\[\[\{\\{\<\\<\|\\|

into this:
a\\a\\+\\-\\*\\\\a+\\\\-\\\\*\\\\a\\\\[\\[\\{\\\\{\\<\\\\<\\|\\\\|

which should back out nicely when handled by postgres.

-- 
Adam Bregenzer
[EMAIL PROTECTED]
http://adam.bregenzer.net/

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

Reply via email to