Zach Smith
Zach Smith

Reputation: 5674

internet explorer 11 Syntax error in regular expression error with javascript RegExp

I am receiving a Syntax error in regular expression error in Internet Explorer 11 and I have tried the following options:

chars = text.split(/(?!$)/u),
chars = text.split(new RegExp("(?!$)", 'u'))
chars = text.split(new RegExp('/(?!$)/', 'u'));

I am curious what I am missing here. [insert comment how this works fine in other browsers]

Upvotes: 1

Views: 3347

Answers (1)

mwld
mwld

Reputation: 225

You are trying to use a regular expression with the unicode flag ("u") which is not supported by any Internet Explorer <= 11.

You can try to use a library like XRegExp.

Upvotes: 3

Related Questions