예제 #1
0
func main() {
	reg := urlregex.Pattern("some/:name/path/:other/")
	fmt.Println("regex: " + reg.Regex.String())

	res, err := reg.Match("some/123/path/456/")
	if err != nil {
		fmt.Println("no matches")
		return
	}

	fmt.Println("found matches")
	for k, v := range res {
		fmt.Println(k + ": " + v)
	}
}
예제 #2
0
파일: methods.go 프로젝트: butaixianran/neo
func (m *methods) add(path string, fn handler, method string) *Route {
	route := Route{&interceptor{[]appliable{}}, fn, urlregex.Pattern(path), nil}
	m.routes[method] = append(m.routes[method], route)

	return &route
}