On Wed, 6 Jun 2001, Wayne Blair wrote:

> >   irb(main):006:0> "one two three".scan(/\w+/)
> >   ["one", "two", "three"]
> >
> > Works for me anyway. :)
> 
> Right, but if you have to use a subexpression, you are out of luck, for
> example when you want to match between 2 quotes but allow for escaped
> quotes:
> 
> /"(\\"|[^"])*"/

Guy's solution is much better, but you can do it with sub-expressions
if you flatten and compact the result. Eg:

  "one two three".scan(/"(\\"|[^"])*"/).flatten.compact

-- 
  spwhite / chariot.net.au