import re


def regression_test_almost_match_file_names(old_fname, new_fname):
    """Checks whether the two file names match (if the files match up to name_i*.ext, it counts
    as if they match)
    """
    if old_fname == new_fname:
        return True

    if '_i' in old_fname:
        if re.sub('_i[0-9]*', '', old_fname) == new_fname:
            return True

    return False