def METHOD_NAME(input, masked_input, search_re):
    output = []
    mask_output = []
    for (line, masked_line) in zip(input, masked_input):
        m = search_re.match(masked_line)
        while m:
            split = len(m.group(1))
            line = line[:split] + r"\n" + line[split:]
            masked_line = masked_line[:split] + r"\n" + masked_line[split:]
            m = search_re.match(masked_line)
        output.extend(line.split(r"\n"))
        mask_output.extend(masked_line.split(r"\n"))
    return (output, mask_output)