I need to do a request mapping for an URL, which would match an empty string, or any string except a specific string after a forward slash character: /
.
The below regex matches any string after /
, and ignores the specific string "resources"
, but it is not matching empty string after that forward slash /
.
@RequestMapping(value = "/{page:(?!resources).*$}")
Current output:
/myapp/abc - matches and handles - ok
/myapp/resoruces - matches and ignores this URL - ok
/myapp/ - not matched <<<<<< expected to match!
What is wrong with this regular expression?