Python: re test with \Z

This commit is contained in:
Rasmus Lerchedahl Petersen
2020-05-26 08:07:13 +02:00
parent 4d6ad32f04
commit f1efdee194
2 changed files with 15 additions and 10 deletions

View File

@@ -1,4 +1,8 @@
| test.py:29:12:29:19 | Str | This regular expression includes an unmatchable dollar at offset 3. |
| test.py:30:12:30:23 | Str | This regular expression includes an unmatchable dollar at offset 3. |
| test.py:31:12:31:20 | Str | This regular expression includes an unmatchable dollar at offset 2. |
| test.py:78:12:78:26 | Str | This regular expression includes an unmatchable dollar at offset 3. |
| test.py:41:10:41:27 | Str | This regular expression includes an unmatchable dollar at offset 5. |
| test.py:41:10:41:27 | Str | This regular expression includes an unmatchable dollar at offset 11. |
| test.py:41:10:41:27 | Str | This regular expression includes an unmatchable dollar at offset 13. |
| test.py:42:10:42:25 | Str | This regular expression includes an unmatchable dollar at offset 3. |
| test.py:79:12:79:26 | Str | This regular expression includes an unmatchable dollar at offset 3. |

View File

@@ -30,15 +30,16 @@ re.compile(b"abc$ ")
re.compile(b"abc$ (?s)")
re.compile(b"\[$] ")
#Likely false positives for unmatchable dollar
re.compile(b"[$] ")
re.compile(b"\$ ")
re.compile(b"abc$(?m)")
re.compile(b"abc$()")
re.compile(b"((a$)|b)*")
re.compile(b"((a$)|b){4}")
re.compile(b"((a$).*)")
#Not unmatchable dollar
re.match(b"[$] ", b"$ ")
re.match(b"\$ ", b"$ ")
re.match(b"abc$(?m)", b"abc")
re.match(b"abc$()", b"abc")
re.match(b"((a$)|b)*", b"bba")
re.match(b"((a$)|b){4}", b"bbba")
re.match(b"((a$).*)", b"a")
re.match("(\Aab$|\Aba$)$\Z", "ab")
re.match(b"((a$\Z)|b){4}", b"bbba")
#Duplicate character in set
re.compile(b"[AA]")