import re


def is_valid_regex(string):
    """
    Checks whether the re module can compile the given regular expression.

    :param string: str

    :return: boolean
    """
    try:
        re.compile(string)
        is_valid = True
    except re.error:
        is_valid = False
    return is_valid