import re


def is_valid_regex(regex):
    """Helper function to determine whether the provided regex is valid.

    Args:
        regex (str): The user provided regex.

    Returns:
        bool: Indicates whether the provided regex was valid or not.

    """
    try:
        re.compile(regex)
        return True
    except (re.error, TypeError):
        return False