Displaying 1 result from an estimated 1 matches for "mryhdlttllmb".
Did you mean:
mrhdlttllmb
2008 Feb 03
4
Extract vowels and consonants using Ruby Regex
...equence
using the following extension to the String class:
class String
def vowels
scan(/[aeiou]/i)
end
def consonants
scan(/[^aeiou]/i)
end
end
examples:
>> "Mary had a little lamb".vowels
=> aaaiea
>> "Mary had a little lamb".consonants
=> mryhdlttllmb
However, the regex does not accommodate the conditional treatment of
''y'' as a vowel *if there is no other vowel before or after it.* If
properly implemented, the previous examples would return: ayaaiea
(vowels) and mrhdlttllmb (consonants).
According to this post (http://www.pe...