import re


def find_name_in_line(pattern, line, replacement=None):
    """
    Use regex to replace the name in the line.

    Args:
        pattern: regex pattern to search for
        line: string in which to search for pattern
        replacement: if provided, text to replace the pattern with
    """
    if re.search(pattern, line):
        if replacement is not None:
            return re.sub(pattern, replacement, line)
        else:
            return True
    else:
        return False