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

> data=line.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+)\"/
=> nil
>> '"What is the temperature?" "Pretty cold"'.match /\"([^"]+)\"\s+\"([^"]+)\"/
=> #<MatchData "\"What is the temperature?\" \"Pretty cold\"" 1:"What
is the temperature?" 2:"Pretty cold">
>> result = '"What is the temperature?" "Pretty cold"'.match /\"([^"]+)\"\s+\"([^"]+)\"/
=> #<MatchData "\"What is the temperature?\" \"Pretty cold\"" 1:"What
is the temperature?" 2:"Pretty cold">
>> result[1]
=> "What is the temperature?"
>> result[2]
=> "Pretty cold"
>>

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