import re


def apply_filter(filter_, extracted):
    """ Helper function to look for exact matches or apply regexes """
    if str(filter_).startswith('|'):
        matches = filter_.split('|')
        if extracted in matches:
            return extracted
    else:
        return ','.join(re.findall(filter_, extracted))