[PHP] Backslashing the [ and ] in a regex

2004-02-04 Thread Sam Masiello
I am kind of stuck on a problem that I am hoping you can help with. I am working on an application where the user can input a regular expression into a text box on a web form. This regular expression will be put into a postgres database, then later into an XML file. My dilemma is that if a

Re: [PHP] Backslashing the [ and ] in a regex

2004-02-04 Thread Adam Bregenzer
On Wed, 2004-02-04 at 14:06, Sam Masiello wrote: $rule = ereg_replace([[:alpha:]+*/.|()$], 0, $rule) ; But if the user backslashes either a left or right bracket ([ or ]), I am having difficulty getting that extra backslash into the string. I tried just adding the [ and ] characters

RE: [PHP] Backslashing the [ and ] in a regex

2004-02-04 Thread Sam Masiello
Thank you for the reply, Adam, but unfortunately it didn't work. --Sam Adam Bregenzer wrote: On Wed, 2004-02-04 at 14:06, Sam Masiello wrote: $rule = ereg_replace([[:alpha:]+*/.|()$], 0, $rule) ; But if the user backslashes either a left or right bracket ([ or ]), I am having

RE: [PHP] Backslashing the [ and ] in a regex

2004-02-04 Thread Chris W. Parker
Sam Masiello mailto:[EMAIL PROTECTED] on Wednesday, February 04, 2004 1:36 PM said: Thank you for the reply, Adam, but unfortunately it didn't work. So you want to accept input that may or may not look like the following? Here is some \[text\] for j00. Well I'm no regex expert but I

RE: [PHP] Backslashing the [ and ] in a regex

2004-02-04 Thread Adam Bregenzer
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