Re: Backslashing the [ and ] in a regex
| From: | Adam Bregenzer | Date: | Wed, 04 Feb 2004 20:19:45 +0000 |
| Subject: | Re: Backslashing the [ and ] in a regex | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-176839@lists.php.net to get a copy of this message | ||
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 to the line above between the
> <> and () characters, but that didn't work along with several other
> iterations of attempts to get it to work.
>
> Does anyone have any ideas? I am stuck.
Try adding \\[\\]
--
Adam Bregenzer
adam@bregenzer.net
http://adam.bregenzer.net/