Tried string.replace(/\u10000-\u10FFFF/g, '')
, but sadly \u
doesn't support 10000+
To specify code points beyond U+FFFF, you need to look for UTF-16 surrogate pairs:
string.replace(/[\uD800-\uDBFF][\uDC00-\uDFFF]/g, '')
For future reference: One of the current ECMAScript proposals is to add a /u
flag to support Unicode supplementary characters, which would allow:
string.replace(/[\u{10000}-\u{10ffff}]/gu, '')
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