Regex in spring controller

后端 未结 2 1993
误落风尘
误落风尘 2020-12-09 08:53

I am trying to build a request filter that will only get used if it matches a pattern of the letter e, then a number. However I cannot seem to get it to work. I keep gettin

2条回答
  •  半阙折子戏
    2020-12-09 09:08

    You should use:

     @RequestMapping("/e{number:\\d+})
    

    Notice the "escaped slash" before the \d digit specifier.

提交回复
热议问题