From: "pauldacus@..." Date: 2005-10-18T04:11:58+09:00 Subject: Re: How to get non-unique elements from an array? That '?!' zero width lookahead regex is nice, Simon. A workable alternative, with nary a block or hash counter to offend the eye: a.sort.join(' ').to_s.scan(/(\d+)\s(\1)+/).flatten.uniq This works for all numbers, not just single digits. Returns a string, which you will 'to_i' in an iterator. Replace the \d with \w for something to find dup strings... I think.