From: dblack@... Date: 2007-06-21T08:17:18+09:00 Subject: Re: strange ... I'm getting crazy Hi -- On Thu, 21 Jun 2007, J. mp wrote: > WTF: > > str = "teste@test.com, alf@test.com, joe@teste.com" > > emails_array = Array.new > emails = str.split(",") > emails.each do |single_str| > > tmp = single_str[/^([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})$/i] > > if !tmp.nil? > emails_array << tmp > > end > end > > > > --- Expected result > > emails_array => ["teste@test.com","alf@test.com","joe@teste.com"] > > > -----Actual result > > emails_array => [teste@test.com] I get: ["teste@test.com", " alf@test.com", " joe@teste.com"] David -- * Books: RAILS ROUTING (new! http://www.awprofessional.com/title/0321509242) RUBY FOR RAILS (http://www.manning.com/black) * Ruby/Rails training & consulting: Ruby Power and Light, LLC (http://www.rubypal.com)