Thanks! I was unaware of that trick.
In reply to Re^2: Behavior of /g when there are capture groups by ExReg in thread Behavior of /g when there are capture groups by ExReg