Merge pull request #47 from chr4/feat/topic-resillience

Make GroupValue() more resilient
This commit is contained in:
Christoph Petrausch
2021-03-06 21:19:07 +01:00
committed by GitHub
+1 -1
View File
@@ -61,7 +61,7 @@ func (rf *Regexp) GroupValue(s string, groupName string) string {
match := rf.r.FindStringSubmatch(s)
groupValues := make(map[string]string)
for i, name := range rf.r.SubexpNames() {
if name != "" {
if len(match) > i && name != "" {
groupValues[name] = match[i]
}
}