Re: (another) regex difficulty
| From: | Curt Zirzow | Date: | Wed, 01 Oct 2003 16:17:55 +0000 |
| Subject: | Re: (another) regex difficulty | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-164570@lists.php.net to get a copy of this message | ||
* Thus wrote jonas_weber @ gmx. ch (jonas_weber@gmx.ch):
> regular expressions
> the example below should turn any character exept "\*" (*= any char)
> into an "x":
>
> $term = preg_replace('/[^(\\\)+(.){1}]/', 'x', $term);
preg_replace('/(?<!\\).{1}/', 'x', $term);
this is untested but using the assertion (?<!\\), meaning that the
string '\' doesn't appear before the character, should be the
direction to go.
see:
http://php.net/manual/en/pcre.pattern.syntax.php
Curt
--
"I used to think I was indecisive, but now I'm not so sure."