From: srinsriram@... Date: 2007-04-07T02:10:09+09:00 Subject: Re: string scan question Here is a simple test case s = \nXXX\n\n\n \n Administrative Support - Supervisors\n\n\n" for the VariableValue tag, there should be 2 array elements \nXXX \n AND \n Administrative Support - Supervisors\n s.scan(/(.+?) wrote: > srinsri...@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 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(/(.+?) > This will put the text contents of all tags into an array. > > Cheers, > Peter > > --http://www.rubyrailways.com:: Ruby and Web2.0 bloghttp://scrubyt.org:: Ruby web scraping frameworkhttp://rubykitchensink.ca/:: The indexed archive of all things Ruby