Skip to content

Commit 3545bb0

Browse files
committed
adjust qhelp based on review
1 parent 31743af commit 3545bb0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

ruby/ql/src/queries/security/cwe-020/MissingFullAnchor.qhelp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<overview>
77
<p>
88
Regular expressions in Ruby can use anchors to match the beginning and end of a string.
9-
However, if the <code>^</code> and <code>$</code> anchors are not used,
9+
However, if the <code>^</code> and <code>$</code> anchors are used,
1010
the regular expression can match a single line of a multi-line string.
1111
</p>
1212
</overview>
@@ -26,14 +26,14 @@
2626

2727
<sample language="ruby">
2828
def bad(input)
29-
raise "Bad input" unless input =~ /[0-9]+/
29+
raise "Bad input" unless input =~ /^[0-9]+$/
3030

3131
# ....
3232
end
3333
</sample>
3434

3535
<p>
36-
The regular expression <code>[0-9]+</code> will match a single line of a multi-line string,
36+
The regular expression <code>/^[0-9]+$/</code> will match a single line of a multi-line string,
3737
which may not be the intended behavior.
3838
To match the entire string, the regular expression should be <code>\A[0-9]+\z</code>.
3939
</p>

0 commit comments

Comments
 (0)