Regex - removing symbols in utf8 text


How is it possible to remove all symbols (",.-=?<>…) from a text and keep all utf-8 international characters ?

For example:

“wärm test-10 +?= madafak < test”
“wärm test10 madafak test”

Thanks for help

You can add unicode ranges using the u modifier.

I tried this:

$input = "wärm test-10 +?= madafak < test";
$output = preg_replace("/[^\\w]/u", ' ', $input);

But it wont really help… it will strip out ä

You need to whitelist the characters you want to keep using the following notation:-

AFAIK anyway. :slight_smile: