Reputation: 1275
Tried string.replace(/\u10000-\u10FFFF/g, '')
, but sadly \u
doesn't support 10000+
Upvotes: 4
Views: 1581
Reputation: 123513
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, '')
Upvotes: 8