From: James Edward Gray II Date: 2007-01-13T02:39:23+09:00 Subject: Re: DRY gsub... On Jan 12, 2007, at 11:35 AM, Robert Dober wrote: > On 1/12/07, Josselin wrote: >> >> I wrote the following ruby statements.. I get the result I need , I >> tried to DRY it for 2 hours without being successfull , >> >> d = d.gsub(/\r\n/,' ') # get rid of carriage return >> d = d.gsub(/;/,' ') # replace column by space >> d = d.gsub(/,/,' ') # replace comma by space >> a = d.split(' ') # split into component , space as divider >> >> tfyl >> >> Joss > > > I know you got lots of answers but what about > > a = d.gsub(/;|,/," ").split No need for a Regexp there: a = d.tr(";,", " ").split James Edward Gray II