19 lines
401 B
Go
19 lines
401 B
Go
package auth
|
|
|
|
import "regexp"
|
|
|
|
type regexpSubmatcher struct {
|
|
re *regexp.Regexp
|
|
}
|
|
|
|
func (resm *regexpSubmatcher) getSubmatches(target string) map[string]string {
|
|
matches := resm.re.FindStringSubmatch(target)
|
|
l := len(matches)
|
|
submatches := make(map[string]string, l)
|
|
for i, name := range resm.re.SubexpNames() {
|
|
if i > 0 && i <= l {
|
|
submatches[name] = matches[i]
|
|
}
|
|
}
|
|
return submatches
|
|
}
|