Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement proper ignoreCase semantics in v mode #66

Open
mathiasbynens opened this issue Jun 30, 2022 · 1 comment
Open

Implement proper ignoreCase semantics in v mode #66

mathiasbynens opened this issue Jun 30, 2022 · 1 comment
Assignees

Comments

@mathiasbynens
Copy link
Owner

Re-using the example from https://v8.dev/features/regexp-v-flag#ignoreCase:

const re1 = /\p{Lowercase_Letter}/giv;
const re2 = /[^\P{Lowercase_Letter}]/giv;

const string = 'aAbBcC4#';

string.replaceAll(re1, 'X');
// → 'XXXXXX4#'

string.replaceAll(re2, 'X');
// → 'XXXXXX4#'

https://babeljs.io/repl/#?code_lz=MYewdgzgLgBATgUwIwwLwwPQB0AOBvAGRAHcE5gBDCBAfQISijIF8MBzASwDcBuAKFCRYiAExpMAbQB6WAAqESZStToMmcZgF123fgPDQY0OBzBtxAcgoBBAEYAhYAGEALAGILe46bYA6RDgANhTACNaBgQAUiEgANDAWABoWAJT8GBgwgEmECYl5-e4WfHzeZv4IQSFhEdEIIvFJqemZOUn5eYVAA&presets=stage-3

This is currently being transpiled into code with different behavior:

const re1 = /\p{Lowercase_Letter}/giu;
const re2 = /[^\P{Lowercase_Letter}]/giu;

const string = 'aAbBcC4#';

string.replaceAll(re1, 'X');
// → 'XXXXXX4#'

string.replaceAll(re2, 'X');
// → 'aAbBcC4#'

cc @nicolo-ribaudo

@nicolo-ribaudo nicolo-ribaudo self-assigned this Jun 30, 2022
@nicolo-ribaudo
Copy link
Collaborator

Should we compile [^\P{Lowercase_Letter}] down to all its individual code points?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants