module RuboCop::Cop::MatchRange

def each_match_range(range, regex)

match of `regex` inside `range`
Return a new `Range` covering the first matching group number for each
def each_match_range(range, regex)
  range.source.scan(regex) { yield match_range(range, Regexp.last_match) }
end

def match_range(range, match)

For a `match` inside `range`, return a new `Range` covering the match
def match_range(range, match)
  range_between(range.begin_pos + match.begin(1), range.begin_pos + match.end(1))
end