Improve regular expression pattern finder.