Here is a question for programmers. I will wait for your comments before answering.
When matching a regular expression, each match is or contains a collection of found strings, the first is the string found by the whole expression, and the rest are the capture groups. Something like /a(b)/ having "ab" and then "b" in the result. So here is the question: does the first item in the collection always contain all the individual capture group items, like "ab" containing "b"?