2

I am trying to find a way to match a route when request contains multiple path and URL always end with /end

For example:

domain.com/api/path1/path2/path3/end

domain.com/api/path1/path2/path3/path4/end

I tried [Route("api/{p:regex(([[\\w-]]*\\/){{1,}})}end")] but this didn't work.

Any recommendation?

Mukyuu
  • 6,436
  • 8
  • 40
  • 59
duongthaiha
  • 855
  • 6
  • 17

1 Answers1

3

regex pattern must be as below:

^(?:[a-z0-9.]+(\/))*end

Note that in the C# language "\" is the operator character. So you must use \\ instead of \.