zloirock/core-js

[RegExp] Incomplete `sticky` flag support implementation / core-js@3.6+ breaks xregexp@4.3- patterns on IE11

Open

#810 geöffnet am 13. Apr. 2020

Auf GitHub ansehen
 (22 Kommentare) (6 Reaktionen) (0 zugewiesene Personen)JavaScript (1.609 Forks)batch import
bugeshelp wanted

Repository-Metriken

Stars
 (23.771 Stars)
PR-Merge-Metriken
 (Keine gemergten PRs in 30 T)

Beschreibung

Related to: https://github.com/angular/angular-cli/issues/17375

There are two issues with XRegExp and core-js I noticed recently:

1) On core-js@3.6.4 this script causes endless loop:

import 'core-js/features/regexp';
import XRegExp from 'xregexp';
window['XRegExp'] = XRegExp; // only to test some patterns in dev tools console

When using core-js@3.5.0 everything works fine.

2) Pattern that is working fine in core-js@3.5.0 now breaks (the \s, whitechar range, is gone)

I'm trying to test the following code:

import XRegExp from 'xregexp';
window['XRegExp'] = XRegExp;

console.log(XRegExp('(^((?=[uuuuuuuuu\\sxxxxxxxxx\\p{L}\\p{N}\\p{P}\\p{S}\\p{M}/])[^;\\\\<>{}])*$)|(^$)'))
console.log(XRegExp('(^((?=[uuuuuuuuu\\sxxxxxxxxx\\p{L}\\p{N}\\p{P}\\p{S}\\p{M}/])[^;\\\\<>{}])*$)|(^$)').test('test me'));

Both uuu... and xxx... added only to see effects in the browser)

And I see two different regexp patterns that got built by xregexp:

core-js@3.5.0 - spaces work fine image

core-js@3.6.4 - spaces break the pattern (notice lack of x chars and \s at the beginning) image

Contributor Guide