From: "David A. Black" Date: 2008-07-20T20:58:22+09:00 Subject: Re: filtering email addresses Hi -- On Sun, 20 Jul 2008, Luca Scaljery wrote: > David A. Black wrote: >> Hi -- >> >> On Sun, 20 Jul 2008, Luca Scaljery wrote: >> >>> >>> doesn't work >> >> str =~ /@/ > > thnx, I was looking for a String#method but this is OK too =~ is a String method. -------------------------------------------------------------- String#=~ str =~ obj => fixnum or nil ------------------------------------------------------------------------ Match---If _obj_ is a +Regexp+, use it as a pattern to match against _str_,and returns the position the match starts, or +nil+ if there is no match. Otherwise, invokes _obj.=~_, passing _str_ as an argument. The default +=~+ in +Object+ returns +false+. "cat o' 9 tails" =~ /\d/ #=> 7 "cat o' 9 tails" =~ 9 #=> false David -- Rails training from David A. Black and Ruby Power and Light: Intro to Ruby on Rails July 21-24 Edison, NJ Advancing With Rails August 18-21 Edison, NJ See http://www.rubypal.com for details and updates!