On Mar 16, 2008, at 4:59 PM, Adam Akhtar wrote:

> I just wondered, if I had multiple marked sections in a string how  
> would
> i capture all of them?
>
> So if my sentance was
>
> "a bannana is a type of ((fruit)) and a dog is a type of ((animal))"  
> how
> could I store fruit and animal for later use via regex?

irb(main):004:0> str = "a bannana is a type of ((fruit)) and a dog is  
a type of ((animal))"
=> "a bannana is a type of ((fruit)) and a dog is a type of ((animal))"

irb(main):005:0> str.scan(/\(\((.*?)\) 
\)/)                                               => [["fruit"],  
["animal"]]
irb(main):006:0>