Remove global flag from regex