Add function to generate regex