(pattern *regexp.Regexp, input string)
| 19 | type BeforeFunc func(c *echo.Context) |
| 20 | |
| 21 | func captureTokens(pattern *regexp.Regexp, input string) *strings.Replacer { |
| 22 | groups := pattern.FindAllStringSubmatch(input, -1) |
| 23 | if groups == nil { |
| 24 | return nil |
| 25 | } |
| 26 | values := groups[0][1:] |
| 27 | replace := make([]string, 2*len(values)) |
| 28 | for i, v := range values { |
| 29 | j := 2 * i |
| 30 | replace[j] = "$" + strconv.Itoa(i+1) |
| 31 | replace[j+1] = v |
| 32 | } |
| 33 | return strings.NewReplacer(replace...) |
| 34 | } |
| 35 | |
| 36 | func rewriteRulesRegex(rewrite map[string]string) map[*regexp.Regexp]string { |
| 37 | // Initialize |
no outgoing calls
no test coverage detected
searching dependent graphs…