import re


def begins_with_pattern(string, pattern):
    """
    Check if a string begins with a pattern.

    Args:
        string (str)
        pattern (str or regular expression)

    Returns:
        bool

    """
    x = re.match(pattern, string)
    if x is None:
        return False
    return True