import re


def _is_match(regex, text):
    """Returns true if the given text matches the given regex pattern."""
    try:
        return re.compile(regex).search(text) != None
    except:
        return False