PHP Regular expression - Remove all non-alphanumeric characters

后端 未结 4 954
无人共我
无人共我 2020-12-18 23:20

I use PHP.

My string can look like this

This is a string-test width åäö and some über+strange characters: _like this?

<

4条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-18 23:37

    \p{xx} is what you are looking for, I believe, see here

    So, try:

    preg_replace("/\P{L}+/u", ' ', $string);
    

提交回复
热议问题