Missing global flag in regex