v0.0.99
This commit is contained in:
@@ -117,7 +117,7 @@ func (m RegexMatch) GroupByName(name string) RegexMatchGroup {
|
||||
// GroupByName returns the value of a matched group (returns empty OptRegexMatchGroup if not found)
|
||||
func (m RegexMatch) GroupByNameOrEmpty(name string) OptRegexMatchGroup {
|
||||
for idx, subname := range m.subnames {
|
||||
if subname == name {
|
||||
if subname == name && (m.submatchesIndex[idx*2] != -1 || m.submatchesIndex[idx*2+1] != -1) {
|
||||
return OptRegexMatchGroup{&RegexMatchGroup{haystack: m.haystack, start: m.submatchesIndex[idx*2], end: m.submatchesIndex[idx*2+1]}}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user