[BUG] Routing couldn't distinguish slashes even though I have the right regexp
- Dominant language
- Go
- Stars
- 25.6k
- Forks
- 2.4k
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
I want to combine multiple routes with slashes into a single parameter, like `/*/suffix` or `/**/suffix`, and `/a/suffix`, `ab/cd/suffix`, `a1/b2/c3/d-4/suffix` can match the rule, but it seems iris couldn't do this now (`path` is not suitable because I have other suffix like `/a/b/c/suffix/another-suffix/and-more-suffix`).
So, I wrote a regexp, and registered a custom macros, like this:
```go
regex := regexp.MustCompile("^[a-z0-9/-]+$")
app.Macros().Get("string").RegisterFunc("name", regex.MatchString)
assert.True(t, regex.MatchString("abc/def/ghi"))
```
I thought this would work, and `/ab/cd/ef/anything-else` could match `/{name:string name()}/anything-alse`, but actually, it didn't!
It seems that al slashes couldn't combine to a single param, maybe except `path`.
Could you please tell me how to implement my requirement above? I am puzzled now..
**To Reproduce**
Steps to reproduce the behavior:
1. register a custom macros:
```go
regex := regexp.MustCompile("^[a-z0-9/-]+$")
app.Macros().Get("string").RegisterFunc("name", regex.MatchString)
```
2. register a routing:
```go
app.Get("/{name:string name()}/balabala", helloWorldHandler)
```
3. try to get
```
curl localhost:8080/a/b/c/balabala
Not Found
```
**Expected behavior**
```go
curl localhost:8080/a/b/c/balabala
hello, world!
```
and we could get the param `name`:
```go
ctx.Params().Get("name") // "a/b/c"
```
**Desktop (please complete the following information):**
- OS: Ubuntu 18.04.LTS
- Go: go version go1.15 linux/amd64
**iris.Version**
- v12.1.9-0.20200814001959-6fee09f11ed1
Contributor guide
Assessment
This issue has not been assessed yet.