From: Colin Bartlett Date: 2008-05-08T17:21:17+09:00 Subject: Re: Check if char in string? ------=_Part_14400_14493397.1210234877624 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline I have a question: If you are only testing if a single character is in a string 'aeiouy' what are the advantages of using a regular expression instead of include? (or index). If I understand correctly what the original poster is trying to do (caveat: I'm not at all sure that I do), it is something like: str = 'you muppet' 0.upto( str.size - 1 ) do | n | if 'aeiouy'.include?( str[ n, 1 ] ) then puts 'vowel' else puts 'consonant' end end Regular expressions will work for more complicated tests (which is why I ought to learn them!), but do they have an advantage for something like this, other than getting used to them? ------=_Part_14400_14493397.1210234877624--