Re: DRY fanatics?

Rick DeNatale wrote:

grp = %{,’([^’]+)’}
rx = /^([A-Za-z0-9,]+)#{grp*3}/

Now, can someone how to make this DRYer?

rx = Regexp.new [’^([\w,]+)’, *["’(.+?)’"]*3].join(’, ')

:wink:

(assuming ‘_’ in the first field is acceptable)

Gennady.

rx = /^([A-Za-z0-9,]+)#{grp*3}/

Now, can someone how to make this DRYer?

rx = Regexp.new [’^([\w,]+)’, *["’(.+?)’"]*3].join(’, ')

:wink:

(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!

On 10/24/06, Gennady B. [email protected] wrote:

Still too WET!
(assuming ‘_’ in the first field is acceptable)
NO NO NO!

I meant make

x = 111

DRYER, all that needless repetition of the digit 1!

Rick DeNatale

My blog on Ruby
http://talklikeaduck.denhaven2.com/

NO NO NO!

I meant make

x = 111

DRYER, all that needless repetition of the digit 1!

lol

sorry, flew over my head.