aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/gorilla/mux/regexp.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/gorilla/mux/regexp.go')
-rw-r--r--vendor/github.com/gorilla/mux/regexp.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/vendor/github.com/gorilla/mux/regexp.go b/vendor/github.com/gorilla/mux/regexp.go
index fd8fe39..0189ad3 100644
--- a/vendor/github.com/gorilla/mux/regexp.go
+++ b/vendor/github.com/gorilla/mux/regexp.go
@@ -109,6 +109,13 @@ func newRouteRegexp(tpl string, matchHost, matchPrefix, matchQuery, strictSlash,
if errCompile != nil {
return nil, errCompile
}
+
+ // Check for capturing groups which used to work in older versions
+ if reg.NumSubexp() != len(idxs)/2 {
+ panic(fmt.Sprintf("route %s contains capture groups in its regexp. ", template) +
+ "Only non-capturing groups are accepted: e.g. (?:pattern) instead of (pattern)")
+ }
+
// Done!
return &routeRegexp{
template: template,