def episode_filter_regex(data: List[Episode], regex: Optional[str] = None) -> List[Episode]:
    """

    :param data: list of bangumi dict
    :param regex: regex
    """
    if regex:
        try:
            match = re.compile(regex)
            data = [s for s in data if match.findall(s.title)]
        except re.error as e:
            if os.getenv("DEBUG"):  # pragma: no cover
                traceback.print_exc()
                raise e
            print_warning(f"can't compile regex {regex}, skipping filter by regex")

    if cfg.enable_global_filters:
        exclude_keywords = [t.strip().lower() for t in cfg.global_filters]
        data = [x for x in data if not x.contains_any_words(exclude_keywords)]

    return data
:param data: list of bangumi dict
:param regex: regex
bgmi/utils/__init__.py