From: "Jan E." Date: 2012-09-12T00:25:32+09:00 Subject: Re: String iterate through regex matches with possition Hi, The MatchData object in $~ has a "offset" method to retrieve the start end end offset a capture group. However, I don't understand why you capture "SP" and "EP". string.scan /SP\s((?:NL\s)*)EP/ do p $~.offset 1 end -- Posted via http://www.ruby-forum.com/.