import re


def compile_regex(regex) -> re.Pattern:
    """
    Compiles regex patterns to filter results.

    :param regex: The regex to create the pattern with.
    :return: The compiled regex pattern.
    """
    return re.compile(rf"^{regex}", re.IGNORECASE | re.MULTILINE)