import re


def filter_lines(lines, pattern):
    """Returns `lines` minus any line matching `pattern`."""
    if isinstance(lines, str):
        lines = lines.split('\n')
    regex = re.compile(pattern)
    lines = [line for line in lines if not regex.match(line)]
    return '\n'.join(lines)