from typing import Iterable
import re


def filter_regex(regex: str, data: Iterable[str]) -> Iterable[str]:
    """
    filter_regex takes a string iterator and returns an iterator that only has
    values that match the regex.
    """

    r = re.compile(regex)
    return filter(lambda datum: r.search(datum), data)