From: Robert Dober Date: 2006-03-28T02:08:15+09:00 Subject: Re: Simple pattern matching ------=_Part_5148_25995024.1143479278611 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On 3/27/06, Minkoo Seo wrote: > > Hi group. > > Sorry for newbie question. Given the line like > > 'node: { title: "15597629" label: "up[0,18 p:-2270.125]" }' > > How can I parse the above string into "15597629" and "up[0,18 > p:-2270.125]"? There are numbers in the first "..." and a-z, :, [, and > ] in the second "..." part. > > Thanks in advance. 'node: { title: "15597629" label: "up[0,18 p:-2270.125]" }' =3D~ %r{(".*?").*?(".*?")} seems a reasonable way to do it. Move the quotes outside the () if you do not want them excluded from the results. Access the data with $1, $2 or Regexp.last_match[1], ...[2] Hope that helps Robert P.S. Regexp questions are never newbee ;-) -- Deux choses sont infinies : l'univers et la b=EAtise humaine ; en ce qui concerne l'univers, je n'en ai pas acquis la certitude absolue. - Albert Einstein ------=_Part_5148_25995024.1143479278611--