tags:

views:

7833

answers:

1

Is there a quick way to find every match of a regular expression in Ruby? I've looked through the Regex object in the Ruby STL and searched on Google to no avail. Thanks!

+54  A: 

this should do the trick

string.scan(/regex/)

http://www.ruby-doc.org/core/classes/String.html#M000827

Jean
Sweet, that does it! Thanks Jean!
Chris Bunch