Skip to content

Commit f1efdee

Browse files
committed
Python: re test with \Z
1 parent 4d6ad32 commit f1efdee

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed
Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
| test.py:29:12:29:19 | Str | This regular expression includes an unmatchable dollar at offset 3. |
22
| test.py:30:12:30:23 | Str | This regular expression includes an unmatchable dollar at offset 3. |
33
| test.py:31:12:31:20 | Str | This regular expression includes an unmatchable dollar at offset 2. |
4-
| test.py:78:12:78:26 | Str | This regular expression includes an unmatchable dollar at offset 3. |
4+
| test.py:41:10:41:27 | Str | This regular expression includes an unmatchable dollar at offset 5. |
5+
| test.py:41:10:41:27 | Str | This regular expression includes an unmatchable dollar at offset 11. |
6+
| test.py:41:10:41:27 | Str | This regular expression includes an unmatchable dollar at offset 13. |
7+
| test.py:42:10:42:25 | Str | This regular expression includes an unmatchable dollar at offset 3. |
8+
| test.py:79:12:79:26 | Str | This regular expression includes an unmatchable dollar at offset 3. |

python/ql/test/query-tests/Expressions/Regex/test.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,16 @@
3030
re.compile(b"abc$ (?s)")
3131
re.compile(b"\[$] ")
3232

33-
#Likely false positives for unmatchable dollar
34-
re.compile(b"[$] ")
35-
re.compile(b"\$ ")
36-
re.compile(b"abc$(?m)")
37-
re.compile(b"abc$()")
38-
re.compile(b"((a$)|b)*")
39-
re.compile(b"((a$)|b){4}")
40-
re.compile(b"((a$).*)")
41-
33+
#Not unmatchable dollar
34+
re.match(b"[$] ", b"$ ")
35+
re.match(b"\$ ", b"$ ")
36+
re.match(b"abc$(?m)", b"abc")
37+
re.match(b"abc$()", b"abc")
38+
re.match(b"((a$)|b)*", b"bba")
39+
re.match(b"((a$)|b){4}", b"bbba")
40+
re.match(b"((a$).*)", b"a")
41+
re.match("(\Aab$|\Aba$)$\Z", "ab")
42+
re.match(b"((a$\Z)|b){4}", b"bbba")
4243

4344
#Duplicate character in set
4445
re.compile(b"[AA]")

0 commit comments

Comments
 (0)