From: "Jan E." Date: 2012-11-01T12:58:45+09:00 Subject: Re: need regex to check for consonants and put number after each consonant Stefano Crocco wrote in post #1082269: > Also note that your regexp won't work as you expected. To match a > character > other than those included in a list, you need to put a ^ at the > beginning of > the list: > if c =~ /[^aeiou]/ This matches *any* character that's not a vowel, for example digits or special chars $, !, %, ... or whitespace etc. If you want consonants, you either have to explictly write them down (like I did in the previous post) or use the intersection of all alphabetic characters [a-z] with the non-vowels [^aeiou]: consonants = /[a-z&&[^aeiou]]/i But since this syntax isn't well-known, I'd probably just write down the characters. -- Posted via http://www.ruby-forum.com/.