I saw a regex to match the url: /^\/users?(?:\/(\d+)(?:\.\.(\d+))?)?/ . I am confused by the use of ?: At the beginning of each group match.
/^\/users?(?:\/(\d+)(?:\.\.(\d+))?)?/
?:
What is the meaning of this?
(?:) ( () are part of the expression) is not an exciting group.
(?:)
()
See http://www.regular-expressions.info/refadv.html .
This is not an exciting group, so if a match is performed, this group will not be captured.
http://www.regular-expressions.info/refadv.html
Read: http://docs.python.org/library/re.html
(?: ...)
Non-convertible version of regular parentheses. Matches any regular expression inside parentheses, but the substring matched by the group cannot be restored after matching or referencing later in the pattern.