Skip to content

Commit d968dd0

Browse files
committed
Removed <strong> usage and updated r?e[m|x] example
1 parent 65b1275 commit d968dd0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

javascript/ql/src/RegExp/DuplicateCharacterInCharacterClass.qhelp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,14 @@ Common mistakes include:
2424
Examine each duplicate character to determine the intended behavior:
2525
</p>
2626
<ul>
27-
<li><strong>If you see <code>|</code> inside square brackets (e.g., <code>[a|b|c]</code>)</strong>: This is usually a mistake. The author likely intended alternation. Replace the character class with a group: <code>(a|b|c)</code></li>
27+
<li>If you see <code>|</code> inside square brackets (e.g., <code>[a|b|c]</code>): This is usually a mistake. The author likely intended alternation. Replace the character class with a group: <code>(a|b|c)</code></li>
2828
<li>If trying to match alternative strings, use parentheses <code>()</code> for grouping instead of square brackets</li>
2929
<li>If the duplicate was truly accidental, remove the redundant characters</li>
3030
<li>If trying to use special regex operators inside square brackets, note that most operators (like <code>|</code>) are treated as literal characters</li>
3131
</ul>
3232

3333
<p>
34-
<strong>Important:</strong> Simply removing <code>|</code> characters from character classes is rarely the correct fix. Instead, analyze the pattern to understand what the author intended to match.
34+
Note that simply removing <code>|</code> characters from character classes is rarely the correct fix. Instead, analyze the pattern to understand what the author intended to match.
3535
</p>
3636

3737
</recommendation>
@@ -53,7 +53,7 @@ To fix this problem, the regular expression should be rewritten to <code>/(passw
5353
<strong>Example 2: CSS unit matching</strong>
5454
</p>
5555
<p>
56-
The pattern <code>r?e[m|x]</code> appears to be trying to match "rem" or "rex", but actually matches "re" followed by any of the characters <code>{m, |, x}</code>. The correct pattern should be <code>r?e(m|x)</code> or <code>(rem|rex)</code>.
56+
The pattern <code>r?e[m|x]</code> appears to be trying to match "rem" or "rex", but actually matches "re" followed by any of the characters <code>{m, |, x}</code>. The correct pattern should be <code>r?e(m|x)</code> or <code>r?e[mx]</code>.
5757
</p>
5858

5959
<p>

0 commit comments

Comments
 (0)