From: "Wolfgang Nádasi-Donner" Date: 2008-01-17T07:19:25+09:00 Subject: Re: regular expression Andrew Stewart wrote: > You can see there's a lot of repetition in the regular expression so > the next step would probably be to DRY it. O.K. - it really increases the readability ;-) re = Regexp.compile((v=p='')+"^#{p="[^#{v='aeiou'}]*"}"+v.split(''). join("[^#{v}]*")+p+'$') p re # => /^[^aeiou]*a[^aeiou]*e[^aeiou]*i[^aeiou]*o[^aeiou]*u[^aeiou]*$/ Wolfgang Nádasi-Donner -- Posted via http://www.ruby-forum.com/.