|
|
|
@ -149,14 +149,13 @@ var reTests = []struct {
|
|
|
|
|
{"^((3[7-9])|([4-9][0-9])|([1-9][0-9][0-9])|(1000))$", "400", []Group{{0, 3}}},
|
|
|
|
|
{"^((3[7-9])|([4-9][0-9])|([1-9][0-9][0-9])|(1000))$", "4000", []Group{}},
|
|
|
|
|
|
|
|
|
|
// Todo - add lookaround tests
|
|
|
|
|
// Lookaround tests
|
|
|
|
|
{"(?<=bo)y", "boy", []Group{{2, 3}}},
|
|
|
|
|
{"bo(?=y)", "boy", []Group{{0, 2}}},
|
|
|
|
|
|
|
|
|
|
// Todo - add numeric range tests
|
|
|
|
|
// Todo - add capturing group tests
|
|
|
|
|
{"(?<=f)f+(?=f)", "fffff", []Group{{1, 4}}},
|
|
|
|
|
{"(?<=f)f+(?=f)", "fffffa", []Group{{1, 4}}},
|
|
|
|
|
|
|
|
|
|
// Todo - add numeric range tests
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var groupTests = []struct {
|
|
|
|
@ -179,6 +178,9 @@ var groupTests = []struct {
|
|
|
|
|
{"(aaa)|(aaaa)", "aaaa", []Match{[]Group{{0, 4}, {-1, -1}, {0, 4}}}},
|
|
|
|
|
{"(aaaa)|(aaa)", "aaaa", []Match{[]Group{{0, 4}, {0, 4}, {-1, -1}}}},
|
|
|
|
|
{"(a)|(aa)", "aa", []Match{[]Group{{0, 2}, {-1, -1}, {0, 2}}}},
|
|
|
|
|
{"(a?)a?", "b", []Match{[]Group{{0, 0}, {0, 0}}, []Group{{1, 1}, {1, 1}}}},
|
|
|
|
|
{"(a?)a?", "ab", []Match{[]Group{{0, 1}, {0, 1}}, []Group{{1, 1}, {1, 1}}, []Group{{2, 2}, {2, 2}}}},
|
|
|
|
|
{"(a?)a?", "aa", []Match{[]Group{{0, 2}, {0, 1}}, []Group{{2, 2}, {2, 2}}}},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestFindAllMatches(t *testing.T) {
|
|
|
|
|