srinsriram / gmail.com wrote: > this is probably elementary but I just havent found the right/ > reliable way to do this (that works always) > > if a string has content in tags such as <TagName> content goes here </ > TagName> whats the best way to put the content inside an array.. the > content can have whitespace chars (end of lines tabs etc) that should > be preserved in the array element. These tags are simple (no > properties). > > I assume that the scan method is relevant but am having trouble > constructing a regex that works reliably. try html_file.scan(/<TagName>(.+?)</).flatten This will put the text contents of all <TagName> tags into an array. Cheers, Peter -- http://www.rubyrailways.com :: Ruby and Web2.0 blog http://scrubyt.org :: Ruby web scraping framework http://rubykitchensink.ca/ :: The indexed archive of all things Ruby