On Tue, Sep 24, 2002 at 03:21:34AM +0900, Mark Probert wrote:
> >c =~ /[A-Za-z0-9_]/
> >Returns 0 if true, nil if false.
> That was my original thought:
> $ cat blah.rb
> c = "C"
> case c
>         when c =~ /[A-Za-z0-9_]/
>                 puts "yip!"
>         else
>                 puts "nope..."
> end
> 
> $ ruby !$
> ruby blah.rb
> nope...
---
a = "abc"
b = "#@%"

if a =~ /[A-Za-z0-9_]/
   puts "found!"
else
   puts "not found... :/"
end

if b =~ /[A-Za-z0-9_]/
   puts "found!"
else
   puts "not found... :/"
end
---

% ruby rb.rb
found!
not found... :/
% _

works for me ;)

> $ ruby -v
> ruby 1.7.2 (2002-07-02) [i386-mswin32]
% ruby -v
ruby 1.6.7 (2002-03-01) [i586-linux]
% _

still 1.6.7... ;)

-- 
[ Wojtek gminick Walczak ][ http://gminick.linuxsecurity.pl/ ]
[ gminick (at) hacker.pl ][ gminick (at) underground.org.pl/ ]