Re: [PHP3] using preg_replace when searching for a literal '\'
| From: | Andrei Zmievski | Date: | Tue, 20 Jun 2000 19:47:03 +0000 |
| Subject: | Re: [PHP3] using preg_replace when searching for a literal '\' | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-2345@lists.php.net to get a copy of this message | ||
> I get the same result - after doing a few tests (/[\\]/, |\\|, etc..) it
> looks like backslash cannot escape itself... ?
This is because \ has a special meaning both in PHP and PCRE. So you
need to doubly-escape it, i.e. \\\\.
-Andrei
Hacker: Any person who derives joy from
discovering ways to circumvent limitations.