From: Joel Pearson Date: 2013-06-09T00:56:14+09:00 Subject: Re: Write a method which takes in a string and returns an array of pairs Sounds like fun, I'll have a go since I've never done something like that before... Here's one way to do it. If this is homework then you'd better be able to explain to your teacher how it works; so I recommend doing some studying of the objects and methods involved: "String#scan", "Regexp", "Capturing Groups", "Enumerable", "Array", and "String#length" 'moossse'.scan(/(\w)(\1*)/).map{|a,b|[a,b.length+1]} -- Posted via http://www.ruby-forum.com/.