On Sat, Dec 26, 2009 at 9:03 AM, Rajinder Yadav <devguy.ca / gmail.com> wrote=
:

> here is the basic code, output followed by a basic explanation

> =A0 data=3Dline.match /\"(\w+)\"\s+\"(\w+)\"/

?? That won't remotely work, unless the "Question" and "Answer"
are both single words, which seems unlikely :-)

Try something like    line.chomp.match /\"([^"]+)\"\s+\"([^"]+)\"/

>> '"What is the temperature?" "Pretty cold"'.match /\"(\w+)\"\s+\"(\w+)\"/
=3D> nil
>> '"What is the temperature?" "Pretty cold"'.match /\"([^"]+)\"\s+\"([^"]+=
)\"/
=3D> #<MatchData "\"What is the temperature?\" \"Pretty cold\"" 1:"What
is the temperature?" 2:"Pretty cold">
>> result =3D '"What is the temperature?" "Pretty cold"'.match /\"([^"]+)\"=
\s+\"([^"]+)\"/
=3D> #<MatchData "\"What is the temperature?\" \"Pretty cold\"" 1:"What
is the temperature?" 2:"Pretty cold">
>> result[1]
=3D> "What is the temperature?"
>> result[2]
=3D> "Pretty cold"
>>

--=20
Hassan Schroeder ------------------------ hassan.schroeder / gmail.com
twitter: @hassan