Q:

How to iterate through string for all regexp matches in Ruby?

We have a string: "<b><c><d><e>"
And this Regexp: /<(\w+)>/i
How can I get ALL of the matches from current string?

A:

"<b><c><d><e>".scan(/<(\w+)>/)

See scan on ruby-docs

