slevithan/xregexp

u flag is needed for Astral characters but it causes trouble in Internet explorer

70ray opened this issue ยท 2 comments

70ray commented

For astral characters u flag is needed: e.g. XRegExp("^(?:[\n\r ๐“€€-๐“€‚])$", "A");
Have to use XRegExp("^(?:[\n\r ๐“€€-๐“€‚])$", "Au") but the u flag causes a javascript crash in Internet Explorer.

XRegExp requires and defers to native handling for flag u and the astral ranges that u enables within character classes. As you mentioned, IE doesn't support flag u natively, so this won't work there.

Would it be possible to approach this a different way, using Unicode scripts, categories, blocks, or properties, rather than an explicit astral range? E.g. XRegExp('^(?:\\p{EgyptianHieroglyphs}|[\n\r])$', 'A').test('๐“€€');

70ray commented

Thanks for your reply. I came across the problem and thought I would mention it. It is not really a problem for us because, although we want to use Astral plane characters in the future and support IE for a short time now, we won't be doing both at the same time.