Arco Voltaico
Arco Voltaico

Reputation: 814

Regex on security path in Symfony 2

I'm trying to have a regex working for strings that exactly matches 2 or 3 long lowcase letters, in order to match /es/user , en/user , cat/user

 - { path: ^/[a-z]+/user, role: [ROLE_USER]} 

is working but is not limiting to 2-3 letters length.

- { path: ^/[a-z]\{2,3}/user, role: [ROLE_USER]}

causes this error:

InvalidConfigurationException: Unrecognized options "3\}/user," under "security.access_control.0"

Upvotes: 0

Views: 1535

Answers (1)

Jurij Veresciaka
Jurij Veresciaka

Reputation: 56

Use single-quotes ( ' ), or double-quotes ( " ).

- { path: '^/[a-z]\{2,3}/user', role: [ROLE_USER]}

Upvotes: 4

Related Questions