Refactored regex_search.py.