in reply to Re^5: Repeated Pattern Matching Fails
in thread Repeated Pattern Matching Fails

Thank you for pointing out the significance of the /g identifier. I have removed it and my script is working as expected.