unicode - Strip U+10000-U+10FFFF from javascript strings -
tried string.replace(/\u10000-\u10ffff/g, '')
, sadly \u
doesn't support 10000+
to specify code points beyond u+ffff, need utf-16 surrogate pairs:
string.replace(/[\ud800-\udbff][\udc00-\udfff]/g, '')
for future reference: 1 of current ecmascript proposals add /u
flag support unicode supplementary characters, allow:
string.replace(/[\u{10000}-\u{10ffff}]/gu, '')
Comments
Post a Comment