Skip to content

Commit 4a87b58

Browse files
committed
Add lookbehind with capture group test
1 parent cff77ec commit 4a87b58

File tree

1 file changed

+15
-6
lines changed

1 file changed

+15
-6
lines changed

testdata/lookaround.toml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -26,34 +26,43 @@ matches = []
2626
name = "lookbehind in quantifier non-repeating"
2727
regex = "(?:(?<=c)a)+"
2828
haystack = "badacacaea"
29-
matches = [[5,6], [7,8]]
29+
matches = [[5, 6], [7, 8]]
3030

3131
[[test]]
3232
name = "lookbehind in quantifier repeating"
3333
regex = "(?:(?<=a)a)+"
3434
haystack = "babaabaaabaaaac"
35-
matches = [[4,5], [7,9], [11,14]]
35+
matches = [[4, 5], [7, 9], [11, 14]]
3636

3737
[[test]]
3838
name = "lookbehind with quantifier"
3939
regex = "(?<=cb+)a"
4040
haystack = "acabacbacbbaea"
41-
matches = [[7,8], [11,12]]
41+
matches = [[7, 8], [11, 12]]
4242

4343
[[test]]
4444
name = "nested lookbehind"
4545
regex = "(?<=c[def]+(?<!fed))a"
4646
haystack = "cdaceacfeeacfedeacfeda"
47-
matches = [[2,3], [5,6], [10,11], [16,17]]
47+
matches = [[2, 3], [5, 6], [10, 11], [16, 17]]
4848

4949
[[test]]
5050
name = "lookbehind with alternation"
5151
regex = "(?<=def|abc)a"
5252
haystack = "defaabcadefbca"
53-
matches = [[3,4], [7,8]]
53+
matches = [[3, 4], [7, 8]]
5454

5555
[[test]]
5656
name = "lookbehind in alternation"
5757
regex = "(?<=c+)a|(?<=d+)a"
5858
haystack = "aabacadaccaddaea"
59-
matches = [[5,6], [7,8], [10,11], [13,14]]
59+
matches = [[5, 6], [7, 8], [10, 11], [13, 14]]
60+
61+
[[test]]
62+
name = "lookbehind next to capture group"
63+
regex = "(?<=c)(a|b)(b|a)"
64+
haystack = "cabacbacb"
65+
matches = [
66+
[[1, 3], [1, 2], [2, 3]],
67+
[[5, 7], [5, 6], [6, 7]],
68+
]

0 commit comments

Comments
 (0)