fixed regex to be outside grep function