From: Jason Lillywhite Date: 2009-08-07T00:27:30+09:00 Subject: Re: remove commas from string Steve Ross wrote: > Why so complex? Perhaps: > > >> s.gsub(/\b(\d+),(\d+)\b/, '\1\2') > => "B747-400, 8357 miles, 561 mph, 56000 lbs." > > Is there a corner case I'm missing here? So I think I would like to try a non-block option but this code above misses the second comma if I have say 12,134,650 lbs instead of 56,000 lbs in my string. It looks like I need Ruby 1.9 to do this: s.gsub(/(?<=\d),(?=\d{3})/, '') If I have not yet installed Ruby 1.9, what would be a good non-block regex that is more robust? -- Posted via http://www.ruby-forum.com/.