diff options
author | Franck Cuny <franck@lumberjaph.net> | 2013-04-27 16:11:16 -0700 |
---|---|---|
committer | Franck Cuny <franck@lumberjaph.net> | 2013-04-27 16:11:16 -0700 |
commit | 6ce15d1c36d9cc4f5ee5c2443964140f72ffcdb1 (patch) | |
tree | 8c50d039962124c5080795e6e603c59a314ac286 /route.go | |
parent | Better error message when adding twice the same route. (diff) | |
download | path-router-6ce15d1c36d9cc4f5ee5c2443964140f72ffcdb1.tar.gz |
Placeholder in URL use the {\w+} form, not :\w+
This is the format supported for URI templates (RFC 6570). We're not using it now but this is something that I consider for a near future.
Diffstat (limited to 'route.go')
-rw-r--r-- | route.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/route.go b/route.go index a33a78f..925bfb5 100644 --- a/route.go +++ b/route.go @@ -28,10 +28,10 @@ type Match struct { Method string } -var componentIsVariable = regexp.MustCompile("^:") -var componentsIsOptional = regexp.MustCompile("^\\?:") -var namedComponentsRegex = regexp.MustCompile("^:(.*)$") -var convertComponent = regexp.MustCompile("^\\??:(.*)$") +var componentIsVariable = regexp.MustCompile("^{[^}]+}$") +var componentsIsOptional = regexp.MustCompile("^\\?{.*}$") +var namedComponentsRegex = regexp.MustCompile("^{(.*)}$") +var convertComponent = regexp.MustCompile("^\\??{(.*)}$") // XXX explain this function func (self *Route) convertComponentName(name string) string { |