zloirock/core-js

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

Open

#810 aberto em 13 de abr. de 2020

Ver no GitHub
 (22 comments) (6 reactions) (0 assignees)JavaScript (1.609 forks)batch import
bugeshelp wanted

Métricas do repositório

Stars
 (23.771 stars)
Métricas de merge de PR
 (Nenhuma PRs mesclada em 30d)

Description

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

Guia do colaborador