I have noticed that there are question asked on how to detect Chinese character with regex. These are some question I read on stackoverflow:
Php check if the string has Chinese chars
detecting chinese characters in php string
And some article outside stackoverflow:
http://www.regular-expressions.info/unicode.html - unicode script
Basically they suggest using either \p{Han}+
or [\x{4e00}-\x{9fa5}]+.*
to detect Chinese character. Is there a way to detect Chinese punctuation mark as well?
Some example (but not all) of Chinese punctuation mark: :?。,《》「」『』-()【】
[\u4e00-\u9fa5]
works for me in VSCode, the other suggested solutions don't. I stumbled on the solution here, which is a online regex interpreter: http://tool.chinaz.com/regex/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With