Hi -- On Sun, 18 Dec 2005, Ross Bamford wrote: > Non greedy quantifiers could probably be used to do this, but given that > your data is quite nicely delimited you may as well just scan ;) > > s = > "<tr><td>Format</td></tr><tr><td>Format2</td></tr><tr><td>Format3</td></tr>" > s.scan(/<td>([^<]*)<\/td>/) { |it| puts it } array.each {|it| puts it } == puts array :-) > outputs: > > Format > Format2 > Format3 > => > "<tr><td>Format</td></tr><tr><td>Format2</td></tr><tr><td>Format3</td></tr>" > > Obviously it doesn't do quite what you want (you need an array) but that part > should be easy to add... scan returns an array, so just grab it: results = s.scan(/.../).flatten # flatten because of the ()'s [And yes, everyone who's about to say it, we all know that you cannot parse arbitrary HTML with a single regular expression.] David -- David A. Black dblack / wobblini.net "Ruby for Rails", from Manning Publications, coming April 2006! http://www.manning.com/books/black