def re_filter(text, regexps):
    if regexps:
        regexps = [re.compile(x) for x in regexps]
        matched_text = []
        for line in text:
            for regexp in regexps:
                if line not in matched_text:
                    found = regexp.search(line)
                    if found:
                        group = found.group()
                        if group:
                            matched_text.append(line)
        if matched_text:
            # Last line is an unnecessary newline
            return matched_text[:-1]
    return text
Filter text using regular expressions
dataset/ETHPy150Open huntrar/scrape/scrape/utils.py/re_filter