From: Nikolai Weibull Date: 2005-04-14T03:02:40+09:00 Subject: Re: pattern matching question Tony Targonski, April 14: > > I' mtrying to match a pattern like this one : 297,12^[2 where 297,12 > > is the grand total. Are you sure all numbers will be formatted in the \d+,\d+ format? What about . in the first set? What about numbers lacking the decimal part? > your_text.scan(/([0-9]+,[0-9]+)\^\[2/) > Will return [["297,12"]], so you might want to stick a .flatten[0] in > there if you know you'll have only a single match. Use (?:…) instead (and \d as it's a lot faster and clearer): your_text.scan(/(?:\d+,\d+)\^\[2/) Enjoy, nikolai -- Nikolai Weibull: now available free of charge at http://bitwi.se/! Born in Chicago, IL USA; currently residing in Gothenburg, Sweden. main(){printf(&linux["\021%six\012\0"],(linux)["have"]+"fun"-97);}