Regex to remove non alphanumeric characters from UTF8 strings

后端 未结 4 484
傲寒
傲寒 2021-01-11 11:36

How can I remove characters, like punctuation, commas, dashes etc from a string, in a multibyte safe manner?

I will be working with input from many different languag

4条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-11 11:58

    Maybe this will be usefull?

    $newstring = preg_replace('/[^0-9a-zA-Z\s]/', $oldstring);
    

提交回复
热议问题