From: Brian Candler Date: 2010-09-21T17:38:51+09:00 Subject: Re: An elegant way... In fact, I forgot it's OK to run off the end of an Array in ruby :-) So the inner loop can simplify to this: j += 1 while src[j+1] == src[j].sub(/\d+/) { $&.succ } -- Posted via http://www.ruby-forum.com/.