The quantifier applies to the whole group
You've seen this in earlier lessons. (ab)+ matches one or more repetitions of 'ab'. (\d{3})? matches an optional 3-digit group. The group is just a way to make the quantifier scope multiple characters.
The capture surprise
Here's the gotcha: when a capturing group has a quantifier, the captured value is only the LAST iteration. Not the full repeated match — just the final round.
Pattern (ab)+ against ababab: the full match is ababab, but group 1's captured value is ab (just the last iteration). To capture the full repeated string, wrap the entire repetition: ((ab)+) — outer group 1 captures ababab, inner group 2 captures the last ab.
Use non-capturing for grouping-only
If you don't need to capture the group's value, use a non-capturing group (?:...). It groups for the quantifier but doesn't allocate a capture slot. Tracks 4 covers this in detail.
For now, the pattern (?:ab)+ repeats 'ab' without trying to capture anything — cleaner and slightly faster.