fixed regex that caused infinite loop