in reply to Re^2: Variable matching on a regex
in thread Variable matching on a regex

You could adapt the code in this node, pushing captures onto an array rather than concatenating them onto a scalar string. It uses regular expression recursion so there are actually two patterns involved rather than one "fixed" regex but the actual match is done just the once without a g flag. Obviously, the global match already shown is a much simpler solution.

I hope this is of interest.

Cheers,

JohnGG