|
| 1 | +[[test]] |
| 2 | +name = "basic lookbehind positive" |
| 3 | +regex = "(?<=b)a" |
| 4 | +haystack = "ba" |
| 5 | +matches = [[1, 2]] |
| 6 | + |
| 7 | +[[test]] |
| 8 | +name = "basic lookbehind negative" |
| 9 | +regex = "(?<!c)a" |
| 10 | +haystack = "ba" |
| 11 | +matches = [[1, 2]] |
| 12 | + |
| 13 | +[[test]] |
| 14 | +name = "basic lookbehind positive no match" |
| 15 | +regex = "(?<=c)a" |
| 16 | +haystack = "ba" |
| 17 | +matches = [] |
| 18 | + |
| 19 | +[[test]] |
| 20 | +name = "basic lookbehind negative no match" |
| 21 | +regex = "(?<!b)a" |
| 22 | +haystack = "ba" |
| 23 | +matches = [] |
| 24 | + |
| 25 | +[[test]] |
| 26 | +name = "lookbehind in quantifier non-repeating" |
| 27 | +regex = "(?:(?<=c)a)+" |
| 28 | +haystack = "badacacaea" |
| 29 | +matches = [[5,6], [7,8]] |
| 30 | + |
| 31 | +[[test]] |
| 32 | +name = "lookbehind in quantifier repeating" |
| 33 | +regex = "(?:(?<=a)a)+" |
| 34 | +haystack = "babaabaaabaaaac" |
| 35 | +matches = [[4,5], [7,9], [11,14]] |
| 36 | + |
| 37 | +[[test]] |
| 38 | +name = "lookbehind with quantifier" |
| 39 | +regex = "(?<=cb+)a" |
| 40 | +haystack = "acabacbacbbaea" |
| 41 | +matches = [[7,8], [11,12]] |
| 42 | + |
| 43 | +[[test]] |
| 44 | +name = "nested lookbehind" |
| 45 | +regex = "(?<=c[def]+(?<!fed))a" |
| 46 | +haystack = "cdaceacfeeacfedeacfeda" |
| 47 | +matches = [[2,3], [5,6], [10,11], [16,17]] |
| 48 | + |
| 49 | +[[test]] |
| 50 | +name = "lookbehind with alternation" |
| 51 | +regex = "(?<=def|abc)a" |
| 52 | +haystack = "defaabcadefbca" |
| 53 | +matches = [[3,4], [7,8]] |
| 54 | + |
| 55 | +[[test]] |
| 56 | +name = "lookbehind in alternation" |
| 57 | +regex = "(?<=c+)a|(?<=d+)a" |
| 58 | +haystack = "aabacadaccaddaea" |
| 59 | +matches = [[5,6], [7,8], [10,11], [13,14]] |
0 commit comments