diff --git a/re_test.go b/re_test.go index 952f351..60dcc21 100644 --- a/re_test.go +++ b/re_test.go @@ -255,6 +255,16 @@ var reTests = []struct { {`\Bz`, nil, `xyz`, []Group{{2, 3}}}, {`z\B`, nil, `xyz`, []Group{}}, {`\Bx`, nil, `xyz`, []Group{}}, + {`\Ba\B`, nil, `a-`, []Group{}}, + {`\Ba\B`, nil, `-a`, []Group{}}, + {`\Ba\B`, nil, `-a-`, []Group{}}, + {`\By\B`, nil, `xy`, []Group{}}, + {`\By\B`, nil, `yz`, []Group{}}, + {`\By\b`, nil, `xy`, []Group{{1, 2}}}, + {`\by\B`, nil, `yz`, []Group{{0, 1}}}, + {`\By\B`, nil, `xyz`, []Group{{1, 2}}}, + {`ab|cd`, nil, `abc`, []Group{{0, 2}}}, + {`ab|cd`, nil, `abcd`, []Group{{0, 2}, {2, 4}}}, // Todo - add numeric range tests } @@ -285,6 +295,9 @@ var groupTests = []struct { {"(a?)a?", nil, "aa", []Match{[]Group{{0, 2}, {0, 1}}, []Group{{2, 2}, {2, 2}}}}, {"a((b.d){3})", nil, "abfdbhdbid", []Match{[]Group{{0, 10}, {1, 10}, {7, 10}}}}, {`(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)(l)\071`, nil, `abcdefghijkl9`, []Match{[]Group{{0, 13}, {0, 1}, {1, 2}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 7}, {7, 8}, {8, 9}, {9, 10}, {10, 11}, {11, 12}}}}, + {`()ef`, nil, `def`, []Match{[]Group{{1, 3}, {1, 1}}}}, + {`(?:)ef`, nil, `def`, []Match{[]Group{{1, 3}}}}, + {`(?:)`, nil, `def`, []Match{[]Group{{0, 0}}, []Group{{1, 1}}, []Group{{2, 2}}}}, } func TestFindAllMatches(t *testing.T) {