mirror of
https://github.com/astaxie/beego.git
synced 2024-11-23 15:00:54 +00:00
fix reg_express
This commit is contained in:
parent
59ca0d063f
commit
99a47e7644
@ -570,6 +570,9 @@ func splitSegment(key string) (bool, []string, string) {
|
||||
param = make([]rune, 0)
|
||||
} else if v == '?' {
|
||||
params = append(params, ":")
|
||||
} else if v == '.' {
|
||||
out = append(out, '\\')
|
||||
out = append(out, v)
|
||||
} else {
|
||||
out = append(out, v)
|
||||
}
|
||||
|
@ -323,8 +323,8 @@ func TestSplitSegment(t *testing.T) {
|
||||
":name:string": {true, []string{":name"}, `([\w]+)`},
|
||||
":id([0-9]+)": {true, []string{":id"}, `([0-9]+)`},
|
||||
":id([0-9]+)_:name": {true, []string{":id", ":name"}, `([0-9]+)_(.+)`},
|
||||
":id(.+)_cms.html": {true, []string{":id"}, `(.+)_cms.html`},
|
||||
"cms_:id(.+)_:page(.+).html": {true, []string{":id", ":page"}, `cms_(.+)_(.+).html`},
|
||||
":id(.+)_cms.html": {true, []string{":id"}, `(.+)_cms\.html`},
|
||||
"cms_:id(.+)_:page(.+).html": {true, []string{":id", ":page"}, `cms_(.+)_(.+)\.html`},
|
||||
`:app(a|b|c)`: {true, []string{":app"}, `(a|b|c)`},
|
||||
`:app\((a|b|c)\)`: {true, []string{":app"}, `(.+)\((a|b|c)\)`},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user