From: Tim Hunter Date: 2008-05-08T06:48:27+09:00 Subject: Re: Check if char in string? globalrev wrote: > On 7 Maj, 22:04, RedWiz wrote: >>> but none of that is what i want to do. >>> i want to chekc if a char is in a string. >>> not check if a char equals another char. >> ok, you don't know regexp >> >> do it > > > but > if str =~ /aeiouy/ > do foo > end > > doesnt work. or i mena it works but iw ant to chekc if it is a vowel > not if contains the expr aeiouy. > how do i delimit the expressins? > if str =~ /[aeiouy]/ do foo end [aeiouy] is a "character class". The regular expression tests if any character in the string is in the class. -- RMagick: http://rmagick.rubyforge.org/ RMagick 2: http://rmagick.rubyforge.org/rmagick2.html