added a function to generate a regex to pass to the link generator