* Thus wrote jonas_weber @ gmx. ch ([EMAIL PROTECTED]):
> 01.10.03 at 18:17 Curt Zirzow wrote:
> >preg_replace('/(?<!\\).{1}/', 'x', $term);
>
> 01.10.03 at 18:27 CPT John W. Holmes wrote:
> >$term = preg_replace('/[^\\]./','x',$term);
>
> they don't work (thanks anyway)
<quote orignal message>
the example below should turn any character exept "\*" (*= any
char) into an "x":
</quote>
Besides that all mine needed was a extra \
$term = 'char \not xed';
preg_replace('/(?<!\\\).{1}/', 'x', $term);
result: xxxxxxnxxxxx
will replace anychar that isnt escaped by \ to an x, with the side
effect that the \ gets x'd too, thus
preg_replace('/(?<!\\\)[\\\]{1}/', 'x', $term);
Finally fixes the problem:
result: xxxxx\nxxxxx
>
> it's pretty simple: i need a regex that matches any character in a
> string except "\*" (* stands for any char that follows the "\").
>
> example: "this is \ba test"
> should match: this a is test
>
> isn't there a way to do this?
This is completly different problem. It isn't a matching issue but
a replacement issue.
preg_replace('/\\\.{1}/', '', $term);
You want to remove all \* characters.
Curt
--
"I used to think I was indecisive, but now I'm not so sure."
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php