From: dblack@... Date: 2006-05-23T19:30:26+09:00 Subject: Re: Problem with reqular expression Hi -- On Tue, 23 May 2006, Ilyas wrote: > I have this string: > > Color1 R=144 G=248 B=255 > > Need regular expression for get R,G,B > How I can simplify it: > > lines.gsub!(/Color1 R=(\d+) G=(\d+) B=(\d+)/) { > puts $1 > puts $2 > puts $3 > } lines.scan(/\d{3}/) would get you all three. David -- David A. Black (dblack@wobblini.net) * Ruby Power and Light, LLC (http://www.rubypowerandlight.com) > Ruby and Rails consultancy and training * Author of "Ruby for Rails" from Manning Publications! > http://www.manning.com/black