简体   繁体   中英

'XRegExp' is undefined using ie11

I'm using XRegExp for checking unicode regular expressions. It works without problem in any browser I have tested except in IE11.

In my script I define the regex to check as:

var unicodeWord = XRegExp("^[\\p{L}']...+$");

And in ie11 I get the following errors:

SCRIPT5009: 'Symbol' is undefined
xregexp.all.js (1730,11)
SCRIPT5009: 'XregExp' is undefined
jquery-3.3.1.slim.min.js (2,31232)

How can I solve this in ie11? I have checked and ie11 is not running in compatibility mode. As well I have read the documentation on xregexp.com but I can't see any way to solve this issue.

I will appreciate some guide to find the solution and if it's possible an explanation why ie11 behaves like that.

The error regarding Symbol is because the latest version of XRegExp uses Symbol which is not defined in IE11. An issue was raised about the problem. Your choices are:

  1. Revert to an older version of XRegExp that does not use Symbol .

  2. Install a polyfill for Symbol before loading XRegExp so that Symbol is present.

  3. Wait for a newer release of XRegExp that is compiled with a polyfill. The fix has been merged but I don't see a release with this fix yet.

The error regarding XregExp just looks like a typo to me. The name is XRegExp , not XregExp .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM