ss/re.go

30 lines
476 B
Go
Raw Permalink Normal View History

2024-05-19 20:48:06 +03:00
package ss
import (
//"regexp"
)
/*type ReChecker struct {
re *regexp.Regexp
handler ContextHandler
}
func Re(re string, handler ContextHandler) *ReChecker {
ret := &ReChecker{}
ret.re = regexp.MustCompile(re)
ret.handler = handler
return ret
}
func (rr *ReChecker) ServeHttp(c *Context) {
match := rr.re.MatchString(c.Path())
if !match {
c.NotFound()
return
}
c.re = rr.re
c.reSubmatches = c.re.FindStringSubmatch(c.Path())
rr.handler.ServeHttp(c)
}*/