From: srinsriram@...
Date: 2007-04-07T02:35:04+09:00
Subject: Re: string scan question
No there isnt any (due to wrapping here)..
I didnt know about the multiline option (seem to have missed that in
the docs). that worked
thanks very much
On Apr 6, 1:27 pm, Peter Szinek
wrote:
> srinsri...@gmail.com wrote:
> > Here is a simple test case
>
> > s = \nXXX\n\n\n
> > \n Administrative Support - Supervisors\n
> > VariableValue>\n\n"
>
> > for the VariableValue tag, there should be 2 array elements \nXXX
> > \n AND \n Administrative Support - Supervisors\n
>
> > s.scan(/(.+?)).flatten returns an empty array
>
> Ah OK, I did not know there can be other tags inside. This works better:
>
> s.scan(/(.+?)<\/VariableValue>/m).flatten
>
> (note the 'm' flag for multiline)
>
> however, to really match your example, I needed this:
>
> s.scan(/(.+?)<\/\n?VariableValue>/m).flatten
>
> are you sure there is a line break between / and the tag name?
>
> 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