From: gminick Date: 2002-09-24T03:19:26+09:00 Subject: Re: another easy one... On Tue, Sep 24, 2002 at 02:37:04AM +0900, gminick wrote: > On Tue, Sep 24, 2002 at 01:09:45AM +0900, Mark Probert wrote: > > 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? > Don't know if it is possible to use include? here, > but you can do this with "=~": > c =~ /[A-Za-z0-9_]/ > Returns 0 if true, nil if false. Other way of doing it: c[/[A-Za-z0-9_]/] for example: a = "blah" if a[/([A-Za-z0-9_])/] # true print $1,"\n" end if a[/([\!\@\%])/] # false print $1,"\n" end -- [ Wojtek gminick Walczak ][ http://gminick.linuxsecurity.pl/ ] [ gminick (at) hacker.pl ][ gminick (at) underground.org.pl/ ]