I have this RequestMapping:
@RequestMapping(value = \"/route/to-{destination}-from-{departure}.html\", method = {RequestMethod.GET, RequestMethod.HEAD})
<
You may use
"/route/to-{destination:(?!.*-from-).+}.html"
The ^
anchor would search for the start of the string and will fail any match here.
The (?!.*-from-)
negative lookahead will fail any input that contains -from-
after any 0+ chars other than line break chars.
The .+
pattern will consume all 1 or more chars other than line break chars to the end of the line.
try using this :->
{destination:^(?!from)+}
or
{destination:^((?!-from-).)+}