import re


def filter_with_regex(files, regex):
    """filters files by regular expressions

    Parameters
    ------
        files (list): list of files
        regex (str): regular expression string

    Returns
    ------
        list: a list of files with regular expression applied
    """
    return [file for file in files if re.search(regex, file)]