Remove global flag from regex search