import re


def create_chat_list(chat):
    """ Creates a list with every text message that has a new timestamp as entries.

    Parameters
    ----------
    chat : list
        List of all lines of chat file

    Returns
    -------
    chat_list
        List of cleaned chat. (One line is a message per timestamp)
        
    """
    new_line_Regex = re.compile(r"\d\d.\d\d.\d\d\, \d\d:\d\d - ") 
    chat_list = []
    for index, message in enumerate(chat):
        new_message_line = new_line_Regex.search(message)
        if new_message_line:
            # Line is a new message
            chat_list.append(message.rstrip("\n"))
        else:
            # Line is not a new message
            chat_list[-1] = chat_list[-1].rstrip("\n") +" " + message.rstrip("\n")

    return chat_list