You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Great job being the first to discover this typo (which I've noticed for a while but never fixed it)! However, my typo was because I added i to the flag list—we should remove that. The first group is actually intended to be a non-capturing group.
Josh-Cena
added
good first issue
A good issue for newcomers to get started with.
and removed
needs triage
Triage needed by staff and/or partners. Automatically applied when an issue is opened.
labels
Dec 6, 2024
MDN URL
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Regular_expressions/Modifier
What specific section or headline is this issue about?
Matching certain words case-insensitively
What information was incorrect, unhelpful, or incomplete?
const pattern = /(?:var|let|const) (?i:foo|bar)\b/i;
pattern.test("let foo;"); // true
pattern.test("const BAR = 1;"); // true
pattern.test("Let foo be a number"); // false
What did you expect to see?
The "-" after the first "?" is missing which turned into a non-capturing group.
const pattern = /(?-i:var|let|const) (?i:foo|bar)\b/i;
pattern.test("let foo;"); // true
pattern.test("const BAR = 1;"); // true
pattern.test("Let foo be a number"); // false
Do you have any supporting links, references, or citations?
No response
Do you have anything more you want to share?
No response
MDN metadata
Page report details
en-us/web/javascript/reference/regular_expressions/modifier
The text was updated successfully, but these errors were encountered: