I have an textfile with this structure:
06-05-13 21:52:10: Wence: Hey how you're doing?
10-05-13 16:14:49: Wence: Everythings okay over here
10-05-13 16:14:52: Wence: Nevermind, I just spoke to your mom and she told me you are fine.
10-05-13 16:14:58: Wence: I'll host the bbq tonight. Would be fun if you came.
From this large string, I need to read the date, time, and message, but I need it in a key/value pair like this:
var message = {"Wence": "Hey how you're doing?", "Wence": "Everythings okay over here"}
var time = {"Wence": "16:14:52", "Wence": "16:14:49"}
var date = {"Wence": "10-05-13", "Wence": "10-05-13"}
I am using these RegEx patterns to find the message, date and time:
Date: /(\d{2})-(\d{2})-(\d{2})/
Time: /(\d{2}):(\d{2}):(\d{2})/
Name: /[A-z][0-9]\:/
Message: (need to figure this out, don't know how to search for a string between patterns)
Strangely enough, when I'm trying to split these regex function like
var date = /(\d{2})-(\d{2})-(\d{2})/;
var dates = chat.split(date);
It doens't split the date in a way that I can save it in an Array.
I splits it like "xx","xx","xx","rest of string","xx","xx","xx
Any help on how to solve this problem and how to parse the message is highly appriciated.