From: Li Chen Date: 2006-10-24T11:15:04+09:00 Subject: Re: How to remove empty element in an array Pete Yandell wrote: > Your solution is broken. It'll delete any string from the array: > > irb(main):001:0> a = [1, 2, 'a', 'b'] > => [1, 2, "a", "b"] > irb(main):002:0> a.delete_if {|x| x =~ /$/} > => [1, 2] Hi, I think this time it should work: regxp for the empty sapce is ^\d*$. irb(main):003:0> a=[1,2,'','', 'a','b'] => [1, 2, "", "", "a", "b"] irb(main):004:0> a.delete_if {|x| x=~/^\d*$/} => [1, 2, "a", "b"] Li -- Posted via http://www.ruby-forum.com/.