|
|
|
@ -50,7 +50,7 @@ var reTests = []struct {
|
|
|
|
|
{"g[ab]c", "gc", []matchIndex{}},
|
|
|
|
|
{"g[ab]c", "gfc", []matchIndex{}},
|
|
|
|
|
{"[ab]*", "aabbbabaababab", []matchIndex{{0, 14}}},
|
|
|
|
|
{"[ab]+", "aabbbabaababab", []matchIndex{{0, 14}}},
|
|
|
|
|
{"[ab]+", "aabbbablaababab", []matchIndex{{0, 7}, {8, 15}}},
|
|
|
|
|
{"[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}}},
|
|
|
|
@ -72,6 +72,12 @@ var reTests = []struct {
|
|
|
|
|
{`\s`, "a b c d", []matchIndex{{1, 2}, {3, 4}, {5, 6}, {6, 7}}},
|
|
|
|
|
{`\<`, "<HTML><body>", []matchIndex{{0, 1}, {6, 7}}},
|
|
|
|
|
{`\(.+\)`, "Not (paranthesized), (so) is (this) not", []matchIndex{{4, 35}}},
|
|
|
|
|
|
|
|
|
|
{"[^abc]+", "qarbtopsaplpclkpasdmb prejip0r,p", []matchIndex{{0, 1}, {2, 3}, {4, 8}, {9, 12}, {13, 16}, {17, 20}, {21, 32}}},
|
|
|
|
|
{"[^a]+", "qqqaq", []matchIndex{{0, 3}, {4, 5}}},
|
|
|
|
|
{"[^0-9]+", "a1b2c3dd", []matchIndex{{0, 1}, {2, 3}, {4, 5}, {6, 8}}},
|
|
|
|
|
{"[^abc]+", "ababababbababaccacacacaca", []matchIndex{}},
|
|
|
|
|
{`\([^)]+\)`, "Not (paranthesized), (so) is (this) not", []matchIndex{{4, 19}, {21, 25}, {29, 35}}},
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestFindAllMatches(t *testing.T) {
|
|
|
|
|