def line_scan(line: str):
    """
    Call this on a line of Java code, get out regex

    :param line: A line of Java code 
    :return: A regex string or None 
    """

    # all the function calls containing regexes (maybe) 
    functions = ["compile", "matches"]

    for func in functions:
        if func in line:
            # start and end index of exp
            start = line.index(func) + len(func) + 1 # 1 from open paren
            end = len(line)-1
            for i, chr in enumerate(line):
                # if it's a closing quote 
                # and you haven't found it yet)
                # and it's not escaped 
                if i > start and chr == line[start] and end == len(line)-1 and line[i-1] != "\\":
                    end = i 
            regex = line[start+1:end]
            return regex

        else: 
            return None