(line: str)
Matches any combination of the following:
    Beginning of a line:
        - 1. to 99.
        - 1 to 99
        - title
        - time in HH(optional):MM(required):SS(required) format
    Middle:
        - dash between spaces (' - ') separating the title and the time
    End of the line:
        - title
        - time in HH(optional):MM(required):SS(required) format

    Achieves the split by assuming as noise, every regex in the NOISE list.
Matches any combination of the following:
    Beginning of a line:
        - 1. to 99.
        - 1 to 99
        - title
        - time in HH(optional):MM(required):SS(required) format
    Middle:
        - dash between spaces (' - ') separating the title and the time
    End of the line:
        - title
        - time in HH(optional):MM(required):SS(required) format
Matches any combination of the following : Beginning of a line : - 1 . to 99 . - 1 to 99 - title - time in HH ( optional ) : MM ( required ) : SS ( required ) format Middle : - dash between spaces ( - ) separating the title and the time End of the line : - title - time in HH ( optional ) : MM ( required ) : SS ( required ) format
def parse_line(line: str):
    """
    Matches any combination of the following:
    Beginning of a line:
        - 1. to 99.
        - 1 to 99
        - title
        - time in HH(optional):MM(required):SS(required) format
    Middle:
        - dash between spaces (' - ') separating the title and the time
    End of the line:
        - title
        - time in HH(optional):MM(required):SS(required) format

    Achieves the split by assuming as noise, every regex in the NOISE list.
    """
    NOISE = [" - ", "^-", "(?:-)?[0-9]{1,2} - ", "(?:-)?[0-9]{1,2}\."]
    # a few years have passed and this reads like magic
    try:
        # Explanation:                     HH optional          MM   and   SS required
        regex = re.compile("(?P<start>(?:([01]?\d|2[0-3]):)?([0-5]?\d):([0-5]?\d))")
        start_time = regex.search(line).group("start")
        title = re.sub("|".join(NOISE), "", regex.sub("", line, count=1)).strip()
        return start_time, title
    except AttributeError:
        raise Exception(f"Error occurred when parsing the line: {line}")
def parse_line ( line : str ) : NOISE = [ " - " , "^-" , "(?:-)?[0-9]{1,2} - " , "(?:-)?[0-9]{1,2}\." ] # a few years have passed and this reads like magic try : # Explanation:                     HH optional          MM   and   SS required regex = re . compile ( "(?P<start>(?:([01]?\d|2[0-3]):)?([0-5]?\d):([0-5]?\d))" ) start_time = regex . search ( line ) . group ( "start" ) title = re . sub ( "|" . join ( NOISE ) , "" , regex . sub ( "" , line , count = 1 ) ) . strip ( ) return start_time , title except AttributeError : raise Exception ( f"Error occurred when parsing the line: {line}" )