Skip to content

Commit 2e23e7f

Browse files
CIAvashalecthomas
authored andcommitted
regexp2 uses number of group as its name so name check isn't needed
1 parent 1b7d2dd commit 2e23e7f

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Diff for: regexp.go

+2-4
Original file line numberDiff line numberDiff line change
@@ -504,11 +504,9 @@ func matchRules(text []rune, pos int, rules []*CompiledRule) (int, *CompiledRule
504504
match, err := rule.Regexp.FindRunesMatchStartingAt(text, pos)
505505
if match != nil && err == nil && match.Index == pos {
506506
groups := []string{}
507-
namedGroups := map[string]string{}
507+
namedGroups := make(map[string]string)
508508
for _, g := range match.Groups() {
509-
if g.Name != `` {
510-
namedGroups[g.Name] = g.String()
511-
}
509+
namedGroups[g.Name] = g.String()
512510
groups = append(groups, g.String())
513511
}
514512
return i, rule, groups, namedGroups

0 commit comments

Comments
 (0)