Skip to content

Commit fd86baa

Browse files
Lab regex0: Hint on unnecessary parentheses
Signed-off-by: David A. Wheeler <[email protected]>
1 parent 6d5bf6c commit fd86baa

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

docs/labs/regex0.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,13 @@ info =
3030
[ "C" ],
3131
],
3232
},
33+
{
34+
present: String.raw`\(`,
35+
text: "Parentheses are not necessary or clarifying in this regex. Prefer simpler regex expressions.",
36+
examples: [
37+
[ "(cat)" ],
38+
],
39+
},
3340
{
3441
absent: "c",
3542
text: "If you are searching for \"cat\" you need to look for a \"c\"",
@@ -93,6 +100,14 @@ info =
93100
[ null, "A+B" ],
94101
],
95102
},
103+
{
104+
present: String.raw`\(`,
105+
index: 1,
106+
text: "Parentheses are not necessary or clarifying in this regex. Prefer simpler regex expressions.",
107+
examples: [
108+
[ null, "(A+B+)" ],
109+
],
110+
},
96111
],
97112
expected: [
98113
'cat',

0 commit comments

Comments
 (0)