The following only matches a path that starts with private
:
access_control:
#...
- { path: ^/private, roles: IS_AUTHENTICATED_ANONYMOUSLY, ip: 127.0.0.1 }
- { path: ^/private, roles: ROLE_NO_ACCESS }
How can I match all the routes that contain /private/
(and do not necessarily start with private
)? For example, something that will match /message/private/blabla
.. the equivalent of [path~="private"]
with jQuery selectors .
Note: Does anyone know how we call the regex we are using here? Is this specific to yml or is this implemented by Symfony, I am confused. Is there a chance I missed this in the doc somewhere, I mean the description with the specific matching patterns like start with, end with, contains etc....
^/
this pattern says everything that starts ( ^
) with slash ( /
) and so on.
I suppose that /private
or something like */private
should work
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.