Added g flag to the regex pattern
Tested and working