From 95db095576a99dd88f1bca769c3df51f3bc1e879 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Thu, 12 May 2022 16:06:56 +0200 Subject: [PATCH 1/6] Add FAQ entry on differences between `v` and `u` --- README.md | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/README.md b/README.md index f864533..a57f270 100644 --- a/README.md +++ b/README.md @@ -194,6 +194,52 @@ In other words, the new flag would indicate several connected changes related to For more discussion see [issue 2](https://github.com/tc39/proposal-regexp-set-notation/issues/2). +### How is the `v` flag different from the `u` flag? + +The answer to this question can be useful when “upgrading” existing `u` RegExps to use `v`. Here’s an overview of the differences: + +1. Previously invalid patterns making use of the new syntax (see above) now become valid, e.g. + + ``` + [\p{ASCII_Hex_Digit}--[Ff]] + \p{RGI_Emoji} + [_\q{a|bc|def}] + ``` + +- Some previously valid patterns are now errors, specifically those with a character class including either an unescaped [special character](https://arai-a.github.io/ecma262-compare/snapshot.html?pr=2418#prod-ClassSetSyntaxCharacter) `(` `)` `[` `]` `{` `}` `/` `-` `\` `|` or [a double punctuator](https://arai-a.github.io/ecma262-compare/snapshot.html?pr=2418#prod-ClassSetReservedDoublePunctuator): + + ``` + [(] + [)] + [[] + [{] + [}] + [/] + [-] + [|] + [&&] + [!!] + [##] + [$$] + [%%] + [**] + [++] + [,,] + [..] + [::] + [;;] + [<<] + [==] + [>>] + [??] + [@@] + [^^] + [``] + [~~] + ``` + +- The `u` flag suffers from confusing case-insensitive matching behavior. The `v` flag has different, improved semantics. See [issue #30](https://github.com/tc39/proposal-regexp-set-notation/issues/30) for details. + ### What’s the precedent in other RegExp flavors? Several other regex engines support some or all of the proposed extensions in some form: From 4af6d416aed4af79e68f1fbd421049959d11fe9a Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Thu, 12 May 2022 16:38:14 +0200 Subject: [PATCH 2/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a57f270..2f76daa 100644 --- a/README.md +++ b/README.md @@ -206,7 +206,7 @@ The answer to this question can be useful when “upgrading” existing `u` RegE [_\q{a|bc|def}] ``` -- Some previously valid patterns are now errors, specifically those with a character class including either an unescaped [special character](https://arai-a.github.io/ecma262-compare/snapshot.html?pr=2418#prod-ClassSetSyntaxCharacter) `(` `)` `[` `]` `{` `}` `/` `-` `\` `|` or [a double punctuator](https://arai-a.github.io/ecma262-compare/snapshot.html?pr=2418#prod-ClassSetReservedDoublePunctuator): +1. Some previously valid patterns are now errors, specifically those with a character class including either an unescaped [special character](https://arai-a.github.io/ecma262-compare/snapshot.html?pr=2418#prod-ClassSetSyntaxCharacter) `(` `)` `[` `]` `{` `}` `/` `-` `\` `|` or [a double punctuator](https://arai-a.github.io/ecma262-compare/snapshot.html?pr=2418#prod-ClassSetReservedDoublePunctuator): ``` [(] From 1d590660c525115da69bb1977b7e8123fbf97d56 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Thu, 12 May 2022 16:38:18 +0200 Subject: [PATCH 3/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2f76daa..ef51579 100644 --- a/README.md +++ b/README.md @@ -238,7 +238,7 @@ The answer to this question can be useful when “upgrading” existing `u` RegE [~~] ``` -- The `u` flag suffers from confusing case-insensitive matching behavior. The `v` flag has different, improved semantics. See [issue #30](https://github.com/tc39/proposal-regexp-set-notation/issues/30) for details. +1. The `u` flag suffers from confusing case-insensitive matching behavior. The `v` flag has different, improved semantics. See [issue #30](https://github.com/tc39/proposal-regexp-set-notation/issues/30) for details. ### What’s the precedent in other RegExp flavors? From e1f1ec6868a6d865ce39835eb8fd297e5cc171b0 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Thu, 12 May 2022 16:38:22 +0200 Subject: [PATCH 4/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ef51579..d6da313 100644 --- a/README.md +++ b/README.md @@ -198,7 +198,7 @@ For more discussion see [issue 2](https://github.com/tc39/proposal-regexp-set-no The answer to this question can be useful when “upgrading” existing `u` RegExps to use `v`. Here’s an overview of the differences: -1. Previously invalid patterns making use of the new syntax (see above) now become valid, e.g. +1. (This is the obvious part.) Previously invalid patterns making use of the new syntax (see above) now become valid, e.g. ``` [\p{ASCII_Hex_Digit}--[Ff]] From 326c11cc65cda2f663c8cfa91585e2087ddf3394 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Thu, 12 May 2022 18:58:15 +0200 Subject: [PATCH 5/6] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index d6da313..46192bc 100644 --- a/README.md +++ b/README.md @@ -206,7 +206,7 @@ The answer to this question can be useful when “upgrading” existing `u` RegE [_\q{a|bc|def}] ``` -1. Some previously valid patterns are now errors, specifically those with a character class including either an unescaped [special character](https://arai-a.github.io/ecma262-compare/snapshot.html?pr=2418#prod-ClassSetSyntaxCharacter) `(` `)` `[` `]` `{` `}` `/` `-` `\` `|` or [a double punctuator](https://arai-a.github.io/ecma262-compare/snapshot.html?pr=2418#prod-ClassSetReservedDoublePunctuator): +1. Some previously valid patterns are now errors, specifically those with a character class including either an unescaped [special character](https://arai-a.github.io/ecma262-compare/snapshot.html?pr=2418#prod-ClassSetSyntaxCharacter) `(` `)` `[` `{` `}` `/` `|` (note: `\` and `]` and `-` are omitted from this list since they require escaping with the `u` flag already) or [a double punctuator](https://arai-a.github.io/ecma262-compare/snapshot.html?pr=2418#prod-ClassSetReservedDoublePunctuator): ``` [(] From 48748ec867c3ced3097fedbb8f50542d786d49a0 Mon Sep 17 00:00:00 2001 From: Mathias Bynens Date: Wed, 18 May 2022 17:29:01 +0200 Subject: [PATCH 6/6] Update README.md Co-authored-by: Markus Scherer --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 46192bc..9d12479 100644 --- a/README.md +++ b/README.md @@ -206,7 +206,7 @@ The answer to this question can be useful when “upgrading” existing `u` RegE [_\q{a|bc|def}] ``` -1. Some previously valid patterns are now errors, specifically those with a character class including either an unescaped [special character](https://arai-a.github.io/ecma262-compare/snapshot.html?pr=2418#prod-ClassSetSyntaxCharacter) `(` `)` `[` `{` `}` `/` `|` (note: `\` and `]` and `-` are omitted from this list since they require escaping with the `u` flag already) or [a double punctuator](https://arai-a.github.io/ecma262-compare/snapshot.html?pr=2418#prod-ClassSetReservedDoublePunctuator): +1. Some previously valid patterns are now errors, specifically those with a character class including either an unescaped [special character](https://arai-a.github.io/ecma262-compare/snapshot.html?pr=2418#prod-ClassSetSyntaxCharacter) `(` `)` `[` `{` `}` `/` `-` `|` (note: `\` and `]` also require escaping inside a character class, but this is already true with the `u` flag) or [a double punctuator](https://arai-a.github.io/ecma262-compare/snapshot.html?pr=2418#prod-ClassSetReservedDoublePunctuator): ``` [(]