Answer by Mladen Jablanović for Get index of string scan results in ruby →
It surprised me that there isn’t any method similar to String#scan which would return array of MatchData objects, similar to String#match. So, if you like monkey-patching, you can combine this…