|
|
@ -148,6 +148,7 @@ var reTests = []struct {
|
|
|
|
{"^((3[7-9])|([4-9][0-9])|([1-9][0-9][0-9])|(1000))$", "040", []Group{}},
|
|
|
|
{"^((3[7-9])|([4-9][0-9])|([1-9][0-9][0-9])|(1000))$", "040", []Group{}},
|
|
|
|
{"^((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))$", "400", []Group{{0, 3}}},
|
|
|
|
{"^((3[7-9])|([4-9][0-9])|([1-9][0-9][0-9])|(1000))$", "4000", []Group{}},
|
|
|
|
{"^((3[7-9])|([4-9][0-9])|([1-9][0-9][0-9])|(1000))$", "4000", []Group{}},
|
|
|
|
|
|
|
|
{"a{1,3}", "aaaaa", []Group{{0, 3}, {3, 5}}},
|
|
|
|
|
|
|
|
|
|
|
|
// Lookaround tests
|
|
|
|
// Lookaround tests
|
|
|
|
{"(?<=bo)y", "boy", []Group{{2, 3}}},
|
|
|
|
{"(?<=bo)y", "boy", []Group{{2, 3}}},
|
|
|
@ -191,7 +192,7 @@ func TestFindAllMatches(t *testing.T) {
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
matchIndices := findAllMatches(regComp, test.str)
|
|
|
|
matchIndices := FindAllMatches(regComp, test.str)
|
|
|
|
zeroGroups := make([]Group, len(matchIndices))
|
|
|
|
zeroGroups := make([]Group, len(matchIndices))
|
|
|
|
for i, m := range matchIndices {
|
|
|
|
for i, m := range matchIndices {
|
|
|
|
zeroGroups[i] = m[0]
|
|
|
|
zeroGroups[i] = m[0]
|
|
|
@ -210,7 +211,7 @@ func TestFindAllGroups(t *testing.T) {
|
|
|
|
if err != nil {
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
matchIndices := findAllMatches(regComp, test.str)
|
|
|
|
matchIndices := FindAllMatches(regComp, test.str)
|
|
|
|
for i := range matchIndices {
|
|
|
|
for i := range matchIndices {
|
|
|
|
for j := range matchIndices[i] {
|
|
|
|
for j := range matchIndices[i] {
|
|
|
|
if matchIndices[i][j].isValid() {
|
|
|
|
if matchIndices[i][j].isValid() {
|
|
|
|