How to match all occurrences of a regex September 10, 2022 by Tarik Using scan should do the trick: string.scan(/regex/)