f00ac810 by astaxie

word change to string

1 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) {
48 expr = part[index:] 48 expr = part[index:]
49 part = part[:index] 49 part = part[:index]
50 //match /user/:id:int ([0-9]+) 50 //match /user/:id:int ([0-9]+)
51 //match /post/:username:word ([\w]+) 51 //match /post/:username:string ([\w]+)
52 } else if lindex := strings.LastIndex(part, ":"); lindex != 0 { 52 } else if lindex := strings.LastIndex(part, ":"); lindex != 0 {
53 switch part[lindex:] { 53 switch part[lindex:] {
54 case ":int": 54 case ":int":
55 expr = "([0-9]+)" 55 expr = "([0-9]+)"
56 part = part[:lindex] 56 part = part[:lindex]
57 case ":word": 57 case ":string":
58 expr = `([\w]+)` 58 expr = `([\w]+)`
59 part = part[:lindex] 59 part = part[:lindex]
60 } 60 }
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!