From: Robert Dober Date: 2008-06-12T19:55:44+09:00 Subject: Re: Newby Ruby Regular Expression Question On Thu, Jun 12, 2008 at 12:44 PM, Ruchira Bomiriya wrote: > Dear Expert, > > I have recently started Ruby programming. I have used Perl before and > liked it mostly due to the power of regular expressions. But Ruby's > ability scale and modularize is absolutely amazing. > > I want to find FOUR instances of A in the string "AaAbAcAd" using > regular expressions. > > I tried > > > and get just one instance (seems like the last 'A') > > The perl equivalent of what I really want is > > $str = "AaAbAcAd" > @md = ($str =~ /A/g) maybe String#scan does the same, sorry my perl times are too remote str = "AaAbAcAd" md = str.scan /A/ HTH Robert -- http://ruby-smalltalk.blogspot.com/ --- As simple as possible, but not simpler. Albert Einstein