Revised Question
Can a regex match an unlimited number of capture groups? If so, how?
Here is an example from the path-to-regexp which seems to match an unlimited number of groups:
([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^()])+)\\))?|\\(((?:\\\\.|[^()])+)\\))([+*?])?|(\\*))
Original Question
How does this regex:
([\\/.])?(?:(?:\\:(\\w+)(?:\\(((?:\\\\.|[^()])+)\\))?|\\(((?:\\\\.|[^()])+)\\))([+*?])?|(\\*))
from path-to-regexp work?
I know it's for parsing URIs for path segments, but it seems to work for any number of path segments -- I didn't think that was possible to do with regular expressions.
Is there a way to break this down into smaller chunks and explain how it works?