import re


def matches_pattern(pattern: str, string: str) -> bool:
    """Check whether string matches pattern."""
    regex = re.compile(pattern)
    search = regex.search(string)
    if search is not None:
        return True
    return False