Commit f00ac810 authored by astaxie's avatar astaxie

word change to string

parent 894634d4
...@@ -48,13 +48,13 @@ func (p *ControllerRegistor) Add(pattern string, c ControllerInterface) { ...@@ -48,13 +48,13 @@ func (p *ControllerRegistor) Add(pattern string, c ControllerInterface) {
expr = part[index:] expr = part[index:]
part = part[:index] part = part[:index]
//match /user/:id:int ([0-9]+) //match /user/:id:int ([0-9]+)
//match /post/:username:word ([\w]+) //match /post/:username:string ([\w]+)
} else if lindex := strings.LastIndex(part, ":"); lindex != 0 { } else if lindex := strings.LastIndex(part, ":"); lindex != 0 {
switch part[lindex:] { switch part[lindex:] {
case ":int": case ":int":
expr = "([0-9]+)" expr = "([0-9]+)"
part = part[:lindex] part = part[:lindex]
case ":word": case ":string":
expr = `([\w]+)` expr = `([\w]+)`
part = part[:lindex] part = part[:lindex]
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment