You can find a regular expression that matches all the visible characters on the keyboard, including @ # $ ...... & Amp; & #215; () and so on. all the information displayed on the keyboard matches, but does not include Chinese, Russian, and so on., PHPcode $ str = '~! @ # $ % ^ & Amp; * () _ + 0124JHB & quot; Hello ghjk '; preg_match_all ('/[[: punct:] \ w find a regular expression
It can match all visible characters on the keyboard, including @ # $ ...... & × () And so on. everything on the keyboard matches, but not Chinese or Russian ..
------ Solution --------------------
PHP code
$ Str = '~! @ # $ % ^ & * () _ + 0124JHB "Hello ghjk '; preg_match_all ('/[[: punct:] \ w]/I ', $ str, $ m); print_r ($ m );
------ Solution --------------------
\ W is an underscore (_)
------ Solution --------------------
Your environment is a bit abnormal, which may be caused by version and encoding problems.
Under normal circumstances, \ w cannot match Chinese.
I can't use [[: punct:] a-z0-9 _]/I
------ Solution --------------------
Indeed, you are not a unicode file.