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

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -