From: Daniel Sheppard Date: 2005-12-21T14:22:15+09:00 Subject: Re: Regex with multiple returns "boringstuff(returnthisplease)notthis(butthis)dontwantthis(butIdowantthi snomatterhowmanyparenthiesisthereare)".scan(/\(([^\)]*)\)/) ==>[["returnthisplease"], ["butthis"], ["butIdowantthisnomatterhowmanyparenthiesisthereare"]] > -----Original Message----- > From: list-bounce@example.com > [mailto:list-bounce@example.com] On Behalf Of List Recv > Sent: Wednesday, 21 December 2005 4:17 PM > To: ruby-talk ML > Subject: Regex with multiple returns > > Is there a Ruby regex that can return all of the following: > boringstuff(returnthisplease)notthis(butthis)dontwantthis(butI > dowantthisnomatterhowmanyparenthiesisthereare) > > If I only had one pair of parens, I would just do: > /[^\(\)]+\((\w+?)\)/ > > but for varying amounts I don't know how to do it. > > (Maybe I could group the whole thing in parens and put a + after it - > but then it would return the whole thing also - is there a way around > this?) > > -- > Posted via http://www.ruby-forum.com/. > > ##################################################################################### This email has been scanned by MailMarshal, an email content filter. ##################################################################################### ##################################################################################### This e-mail message has been scanned for Viruses and Content and cleared by NetIQ MailMarshal #####################################################################################