Jonas_weber @ Gmx . Ch wrote:
> regular expressions
> the example below should turn any character exept "\*" (*= any char)
> into an "x":
>
> $term = preg_replace('/[^(\\\)+(.){1}]/', 'x', $term);
>
> but i guess because of the [brackets] the "." (period) is treated as
> character "." instead as metacharacter (that matches any char).

I'm new to regex too, but if you want to match anything that's not an *,
couldn't it be done like this?

$term = preg_replace('/[^\*\s]*/', 'x', $term);

I put the \s there to skip the whitespace characters too. I haven't tested,
but I hope it helps.

Cristian

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to