January 2019
Intermediate to advanced
520 pages
14h 32m
English
The USER_PATH expression can fit the following paths:
These cases can be handled with the "^/user/((?P<user_id>\\d+?)/?)?$" regular expression. This expression is a bit complex. It includes two groups (one is nested) and some other strange characters. Let's have a closer look.
?P<name> is a grouping attribute that sets the name of the capturing group. Every group in brackets can be accessed by the regex::Captures object. Named groups can be accessed by names.
\\d is a special expression that matches any digit. To specify that we have one or more digits, we should add the + symbol, which tells ...
Read now
Unlock full access