From 14f5df0128b7c89faab437c00d0ea98fb56e03a0 Mon Sep 17 00:00:00 2001 From: Oliver Tonnhofer Date: Tue, 20 Sep 2016 16:06:56 +0200 Subject: [PATCH] document non-capturing groups (closes #143) --- doc.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/doc.go b/doc.go index 291ef5e..e9573dd 100644 --- a/doc.go +++ b/doc.go @@ -47,6 +47,10 @@ variable will be anything until the next slash. For example: r.HandleFunc("/articles/{category}/", ArticlesCategoryHandler) r.HandleFunc("/articles/{category}/{id:[0-9]+}", ArticleHandler) +Groups can be used inside patterns, as long as they are non-capturing (?:re). For example: + + r.HandleFunc("/articles/{category}/{sort:(?:asc|desc|new)}", ArticlesCategoryHandler) + The names are used to create a map of route variables which can be retrieved calling mux.Vars():