Skip to content Skip to sidebar Skip to footer

Javascript Syntax Error Caused By Regex - Specific To Internet Explorer(all Versions)

I have a web application I ported from a Cordova project which works without problems on all common browsers except for IE. So far I have tested this application in Chrome, Chromiu

Solution 1:

You cannot have u as the unicode flag in Internet Explorer. It is not supported yet. Please change your RegEx to:

usr_id = /\[usr_id\] => (.*?)\n/gm.exec(response);

Also, you can check the support by checking the response of:

RegExp.prototype.unicode

And if it supported for the browsers, use the u flag, as it breaks your original logic without that. With this change, at least, it works in Internet Explorer gracefully. This can be checked using:

(new RegExp()).unicode

It might return undefined in Internet Explorer, while false in other browsers.


Post a Comment for "Javascript Syntax Error Caused By Regex - Specific To Internet Explorer(all Versions)"