From: William Djaja Tjokroaminata Date: 2002-09-24T03:18:26+09:00 Subject: Re: another easy one... Hi, As has been pointed out, I think you were mixing string, regular expression and array. If you want to use regexp, you can write c =~ /[A-Za-z0-9_]/ # will give you the char pos or nil If you want to use array, you can write [('A'..'Z').to_a, ('a'..'z').to_a, (0..9).to_a, '_'].flatten.include? c # will give you true or false And if you want to use string, you wrote it correctly: c.count("A-Za-z0-9_") # will give you the number of occurences Regards, Bill =========================================================================== Mark Probert wrote: > My brain just isn't working this morn... > Say, ch is a character and I want to find if it > exists in a regexp /A-Za-z0-9_/. How do I do it? > irb> c.include?(/A-Za-z0-9_/) > "TypeError: cannot convert Regexp into String" > I can do: > irb> c.count("A-Za-z0-9_") > 1 > And look for a 0 being a non-match. > Help, please! :-) > -mark.