Put back regexp patterns and some bug fixes in multiple pattern handling