Regular expression

The syntax of regular expressions used by Ogo is different from the standard ones, but is closely related to RE2 regular expressions, with some specificities.

Regular expressions are used for the URL Exception and Access Control features.

They allow you to create patterns that will match the requests you want to process with the given functionality.

 

How to use it ?

The regular expressions currently used by Ogo deal with URLs, so they must start with /.

Examples:

  • /api
    Covers URLs like : '/apiv2', '/api/toto'

  • /api/ 
    Covers URLs like : '/api/toto', but not like : '/apiv2'. 

  • /api/articles/{id:[0-9]+}
    {id:[0-9]+} will match a number repetition ([0-9] to ask for a number, + to specify that it will eventually repeat)
    Covers URLs like : '/api/articles/123/anything' but nor '/api/articles/toto'