(s string)
| 53 | } |
| 54 | |
| 55 | func (r *Regexp) MatchString(s string) bool { |
| 56 | // if we're memoizing check existing matches |
| 57 | if r.matches != nil { |
| 58 | if matched, ok := r.matches[s]; ok { |
| 59 | return matched |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | matched := false |
| 64 | for _, m := range r.matchers { |
| 65 | if m.MatchString(s) == r.shouldMatch { |
| 66 | matched = true |
| 67 | break |
| 68 | } |
| 69 | } |
| 70 | |
| 71 | if r.matches != nil && len(r.matches) < maxMemoize { |
| 72 | r.matches[s] = matched |
| 73 | } |
| 74 | |
| 75 | return matched |
| 76 | } |
| 77 | |
| 78 | func (r *Regexp) Reset() { |
| 79 | if r.matches != nil { |
no outgoing calls