> >>> Anybody know a way to make this DRYer?
> >>>
> >>>     when /^([A-Za-z0-9,]+), '([^']+)', '([^']+)', '([^']+)'/
> >>
> >> grp = %{ '([^']+)'}
> >> rx = /^([A-Za-z0-9,]+),#{grp},#{grp},#{grp}/
> >
> > Still too WET!
> >
> > grp = %{,'([^']+)'}
> > rx = /^([A-Za-z0-9,]+)#{grp*3}/
> >
> > Now, can someone how to make this DRYer?
>
> rx = Regexp.new ['^([\w,]+)', *["'(.+?)'"]*3].join(', ')
>
> ;-)
>
> (assuming '_' in the first field is acceptable)

Beautiful! Or wait, did I mean beautiful? Maybe I meant sick and wrong.

But you know what, just to taunt you Perlish types...

The initial regex I posted was actually wrong.

It was this:

when /^([A-Za-z0-9,]+), '([^']+)', '([^']+)', '([^']+)'/

It needed to be this instead:

when /^([A-Za-z0-9,]+), '([^']+)', '([^']+)', '([^']*)'/

Bet you can't DRY that!

-- 
Giles Bowkett
http://www.gilesgoatboy.org