Find two occurrences of cat
- Input
- Pattern: (cat); text: cat dog cat; flags: g
- Result
- 2 matches; both cat words highlighted; group $1 = cat for each match
- How to check it
- The global flag finds cat at the start and after dog; parentheses capture cat each time.