func (r *RegexRouter) OPTIONS(regexPath string, handlers ...gin.HandlerFunc) *RegexRouter {
	return r.Handle("OPTIONS", regexPath, handlers...)
}
OPTIONS is a shortcut for router.Handle("OPTIONS", path, handle).
package ginregex
import (
	"fmt"
	"github.com/gin-gonic/gin"
	"strings"
)
var regexRouters = make(map[*gin.Engine]*RegexRouter)
func New(engine *gin.Engine, hook Hook) *RegexRouter {
	router, ok := regexRouters[engine]
	if !ok {
		initOffset()
		router = &RegexRouter{
			engine: engine,
			hook:   hook,
			table:  make(map[string][]*regexHandler),
		}
		router.patchEngine()
		regexRouters[engine] = router
	}
	return router
}
type Hook func(c *gin.Context, regexPattern string)
type RegexRouter struct {
	engine   *gin.Engine
	hook     Hook
	handlers gin.HandlersChain
	table    map[string][]*regexHandler
}
func (r *RegexRouter) Use(middleware ...gin.HandlerFunc) *RegexRouter {
	r.handlers = append(r.handlers, middleware...)
	return r
}
func (r *RegexRouter) Handle(httpMethod, regexPattern string, handlers ...gin.HandlerFunc) *RegexRouter {
	methodHandlers := r.table[httpMethod]
	for _, h := range methodHandlers {
		if strings.TrimPrefix(h.pattern, "^") ==
			strings.TrimPrefix(regexPattern, "^") {
			panic(fmt.Sprintf("register duplicate regex route: %s %s", httpMethod, regexPattern))
		}
	}
	handler := newRegexHandler(regexPattern, handlers)
	r.table[httpMethod] = append(methodHandlers, handler)
	return r
}
func (r *RegexRouter) Any(regexPath string, handlers ...gin.HandlerFunc) *RegexRouter {
	for _, method := range []string{"GET", "POST", "PUT", "PATCH", "HEAD", "OPTIONS", "DELETE", "CONNECT", "TRACE"} {
		r.Handle(method, regexPath, handlers...)
	}
	return r
}
func (r *RegexRouter) GET(regexPath string, handlers ...gin.HandlerFunc) *RegexRouter {
	return r.Handle("GET", regexPath, handlers...)
}
func (r *RegexRouter) POST(regexPath string, handlers ...gin.HandlerFunc) *RegexRouter {
	return r.Handle("POST", regexPath, handlers...)
}
func (r *RegexRouter) DELETE(regexPath string, handlers ...gin.HandlerFunc) *RegexRouter {
	return r.Handle("DELETE", regexPath, handlers...)
}
func (r *RegexRouter) PATCH(regexPath string, handlers ...gin.HandlerFunc) *RegexRouter {
	return r.Handle("PATCH", regexPath, handlers...)
}
func (r *RegexRouter) PUT(regexPath string, handlers ...gin.HandlerFunc) *RegexRouter {
	return r.Handle("PUT", regexPath, handlers...)
}