zloirock/core-js

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

Open

#810 aperta il 13 apr 2020

Vedi su GitHub
 (22 commenti) (6 reazioni) (0 assegnatari)JavaScript (1609 fork)batch import
bugeshelp wanted

Metriche repository

Star
 (23.771 star)
Metriche merge PR
 (Nessuna PR mergiata in 30 g)

Descrizione

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

Guida contributor