From: Rick DeNatale Date: 2008-01-17T07:47:57+09:00 Subject: Re: regular expression On 1/16/08, Wolfgang Nádasi-Donner wrote: > Rick Denatale wrote: > > Something like this? > > irb(main):001:0> "frabelious" =~ /a.*?e.*?i.*?o.*?u/ > > => 2 > > This doesn't work as expected... > > irb(main):001:0> "xaxxixxexxixxuxxoxxuxx".match(/a.*?e.*?i.*?o.*?u/)[0] > => "axxixxexxixxuxxoxxu" > > ..., because it allows all wovels in any order in the word, if there is > one possible grouping with the wanted ordering - The subpattern "a.*?e" > for example allows any number of "a"s, "i"s, "o"s, and "u"s between the > "a" and the "e". Ahh, but "xaxxixxexxixxuxxoxxuxx" DOES contain the vowels in alphabetical order, the original problem statement said nothing about disallowing additional vowels. I really posted my "solution" to drive out what he really wanted. Kind of a test-driven approach. -- Rick DeNatale My blog on Ruby http://talklikeaduck.denhaven2.com/