From: Cheri Ruska Date: 2008-01-31T04:54:16+09:00 Subject: Re: Parsing a string with quotes Thank you for your help. Where is a good resource to read up on what this code means? %r/["'][^"']+["']|\w+/ Thanks, Cheri ara howard wrote: > On Jan 30, 2008, at 12:28 PM, Cheri Ruska wrote: > >> My dog "ate" my "math homework" and "my cat" > > > > cfp2:~ > cat a.rb > string = 'My dog "ate" my "math homework" and "my cat"' > > re = %r/["'][^"']+["']|\w+/ > > tokens = string.scan re > > puts tokens > > > > cfp2:~ > ruby a.rb > My > dog > "ate" > my > "math homework" > and > "my cat" > > > > a @ http://codeforpeople.com/ -- Posted via http://www.ruby-forum.com/.