re.go 476 B

1234567891011121314151617181920212223242526272829
  1. package ss
  2. import (
  3. //"regexp"
  4. )
  5. /*type ReChecker struct {
  6. re *regexp.Regexp
  7. handler ContextHandler
  8. }
  9. func Re(re string, handler ContextHandler) *ReChecker {
  10. ret := &ReChecker{}
  11. ret.re = regexp.MustCompile(re)
  12. ret.handler = handler
  13. return ret
  14. }
  15. func (rr *ReChecker) ServeHttp(c *Context) {
  16. match := rr.re.MatchString(c.Path())
  17. if !match {
  18. c.NotFound()
  19. return
  20. }
  21. c.re = rr.re
  22. c.reSubmatches = c.re.FindStringSubmatch(c.Path())
  23. rr.handler.ServeHttp(c)
  24. }*/