import re


def matches(pattern):
    """Create a predicate that accepts strings matching the pattern."""

    def predicate(text):
        match = re.search(pattern, text)
        return match is not None

    return predicate