Reputation: 18864
In my application which uses spring security I want to define two different areas both using their own spring security filter-chain. My question is: is it possible to define two regex expressions as follows:
The important part here is that the second path should also match if somewhere within it, but not in the beginning, it cotains the /foobar/ string.
Thanks
Upvotes: 4
Views: 2503
Reputation: 336078
^/foobar/.*$
will match if the path starts with /foobar/
;
^(?!/foobar/).*$
will match any path that doesn't start with /foobar/
((?!...)
is a so-called negative lookahead assertion).
Upvotes: 5