On Wed, May 7, 2008 at 4:48 PM, Tim Hunter <TimHunter / nc.rr.com> wrote:
> globalrev wrote:
>
> > On 7 Maj, 22:04, RedWiz <red... / inwind.it> 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.

Get a good book on regular expressions.  Trust me, it will seriously
help you in the long run for most any type of programming/system
interaction.  If you want a quick look at some syntax,
http://www.regular-expressions.info might help.  Note that, this is
only one of many ways to do what you are trying to do, but I think it
is the best way for this case.

hth,
Todd