import re


def convert_chat_to_list(chat):
    """Converts str whatsapp chat to list of str using regex to identify date. Date is of format '[18/06/17, 22:47:15]'


    Args:
        chat (str): WhatsApp string chat

    Returns:
        list: list of msg strings where they have been split by date regex
    """
    # wa timestamps all messages - use that to separate
    WA_DATETIME_FMT = r'\[([0-2][0-9]|(3)[0-1])(\/)(((0)[0-9])|((1)[0-2]))(\/)(\d{2}|\d{4}), ([0-9][0-9]):([0-9][0-9]):([0-9][0-9])\]'
    # form start and end str indices of all messages
    msg_starts = [m.start() for m in re.finditer(WA_DATETIME_FMT, chat)]
    msg_ends = msg_starts[1:]
    msg_ends.append(len(chat))
    # use these to get messages as list of strings
    msgs = [chat[x:y] for x, y in zip(msg_starts, msg_ends)]
    return msgs