http://qs321.pair.com?node_id=640650


in reply to Arbitrary number of captures in a regular expression

First match the surrounding strings, ending the match just before the "body". Then start just after that header and pull out all the digits.
if (/^foo (?=.*bar$)/g) { @matches = /\Gm (\d+) /g; }