Re: Perl regular expression bug
| From: | Richard Lynch | Date: | Tue, 16 Jan 2001 04:02:56 +0000 |
| Subject: | Re: Perl regular expression bug | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-34755@lists.php.net to get a copy of this message | ||
> <?PHP
> $string = "[[";
Okay. I don't think [ is special in PHP. { is a new special character,
though.
> $string = preg_replace("/(\W)/", "\\\\1", $string);
\W -- what's that? You probably need \\W there...
> ?>
>
> $string would then contain "\[\[".
I dunno about that. This Regex stuff is over my head usually. I find that
I can usually write a str_replace and/or use strtok and write a mini-parser
faster than I can wrap my poor little brain around all those secret
characters.