title: Matching position in gsub or scan
body: <p>What is the best way to achieve the matching position (the index that would be returned by <code>=~</code>) for each match when using <code>gsub</code> or <code>scan</code>?</p>