I am trying to remove chinese characters from string. Tried this but can't get this working. It says:
Warning: preg_replace() [function.preg-replace]: Compilation failed: character value in \x{...} sequence is too large at offset 9 in
preg_replace('/[^\x{4e00}-\x{9fa5}]+/', '', $string)
How can I get this working ?
In UTF-8 mode, "\x{...}" is allowed, where the contents of the braces is a string of hexadecimal digits.
You don't appear to be in UTF-8 mode. To enable this mode, add the u modifier to the end of the 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