|
|
@ -31,7 +31,9 @@ var reTests = []struct {
|
|
|
|
{"a*", "", []matchIndex{{0, 0}}},
|
|
|
|
{"a*", "", []matchIndex{{0, 0}}},
|
|
|
|
{"a|b", "c", []matchIndex{}},
|
|
|
|
{"a|b", "c", []matchIndex{}},
|
|
|
|
{"(a|b)*c", "aabbc", []matchIndex{{0, 5}}},
|
|
|
|
{"(a|b)*c", "aabbc", []matchIndex{{0, 5}}},
|
|
|
|
|
|
|
|
{"a(b|b)", "ab", []matchIndex{{0, 2}}},
|
|
|
|
{"a*", "aaaaaaaa", []matchIndex{{0, 8}, {8, 8}}},
|
|
|
|
{"a*", "aaaaaaaa", []matchIndex{{0, 8}, {8, 8}}},
|
|
|
|
|
|
|
|
|
|
|
|
{"ab?", "ab", []matchIndex{{0, 2}}},
|
|
|
|
{"ab?", "ab", []matchIndex{{0, 2}}},
|
|
|
|
{"a?b", "ab", []matchIndex{{0, 2}}},
|
|
|
|
{"a?b", "ab", []matchIndex{{0, 2}}},
|
|
|
|
{"a?", "", []matchIndex{{0, 0}}},
|
|
|
|
{"a?", "", []matchIndex{{0, 0}}},
|
|
|
@ -40,7 +42,20 @@ var reTests = []struct {
|
|
|
|
{"a?b?c?", "ac", []matchIndex{{0, 2}}},
|
|
|
|
{"a?b?c?", "ac", []matchIndex{{0, 2}}},
|
|
|
|
{"a?b?c", "abc", []matchIndex{{0, 3}}},
|
|
|
|
{"a?b?c", "abc", []matchIndex{{0, 3}}},
|
|
|
|
{"a?b?c", "acb", []matchIndex{{0, 2}}},
|
|
|
|
{"a?b?c", "acb", []matchIndex{{0, 2}}},
|
|
|
|
{"a(b|b)", "ab", []matchIndex{{0, 2}}},
|
|
|
|
|
|
|
|
|
|
|
|
{"[abc]", "defadefbdefce", []matchIndex{{3, 4}, {7, 8}, {11, 12}}},
|
|
|
|
|
|
|
|
{"[ab]c", "ab", []matchIndex{}},
|
|
|
|
|
|
|
|
{"g[ab]c", "gac", []matchIndex{{0, 3}}},
|
|
|
|
|
|
|
|
{"g[ab]c", "gbc", []matchIndex{{0, 3}}},
|
|
|
|
|
|
|
|
{"g[ab]c", "gc", []matchIndex{}},
|
|
|
|
|
|
|
|
{"g[ab]c", "gfc", []matchIndex{}},
|
|
|
|
|
|
|
|
{"[ab]*", "aabbbabaababab", []matchIndex{{0, 14}}},
|
|
|
|
|
|
|
|
{"[ab]+", "aabbbabaababab", []matchIndex{{0, 14}}},
|
|
|
|
|
|
|
|
{"[Ff]r[Uu]it", "fruit", []matchIndex{{0, 5}}},
|
|
|
|
|
|
|
|
{"[Ff]r[Uu]it", "FrUit", []matchIndex{{0, 5}}},
|
|
|
|
|
|
|
|
{"[Ff]r[Uu|]it", "Fr|it", []matchIndex{{0, 5}}},
|
|
|
|
|
|
|
|
{"[Ff]r([Uu]|[pP])it", "Frpit", []matchIndex{{0, 5}}},
|
|
|
|
|
|
|
|
{"[Ff]r[Uu]|[pP]it", "Frpit", []matchIndex{{2, 5}}},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
func TestFindAllMatches(t *testing.T) {
|
|
|
|
func TestFindAllMatches(t *testing.T) {
|
|
|
|