Abstracted get_search_regex for future testing

To prepare for speed comparison, I've abstracted a `get_search_regex` method.