replace   characters that are hidden in text

后端 未结 4 548
傲寒
傲寒 2020-12-07 13:35

How to remove   (that are hidden) and SPACES in below text but

  • hold UNICODE characters
  • hold
    tag
4条回答
  •  悲&欢浪女
    2020-12-07 14:04

    All solutions above kind of work, until one starts to work with German language where there are such letters:

    ä ä
    

    and othere simial ones. I use the following code:

    $string = preg_replace ( "!\s++!u", ' ', $string );
    

    More details here: PCRE(3) Library Functions Manual

提交回复
热议问题