title: What is the easiest/most elegant way to iterate over matches in a vim script/function?
body: <p>I am looking for an elegant solution to (within vim script) iterate over all matches of
  a regular expression in a buffer. That would be something like </p>
  
  <pre><code>fu! DoSpecialThingsWithMatchedLines()
  
    for matched_line_no in (GetMatchedPositions("/foo\\&gt;.*\\&lt;bar"))
        let line = getline(matched_line_no)
        call DoItPlease(line)
    end for
  
  endfu
  </code></pre>
  
  <p>Is there something like this? I am not necessarily looking for a full fledged
  solution, any pointer directing me into the right direction will do.</p>
  
  <p>Thanks / Rene</p>