I've got a regex like this:
var regex = /(\d\d\/\d\d\/\d\d) (\d\d:\d\d:\d\d): ([^:]+): (.*)/g;
this a regex to read the string below and divide it up into several object properties
27/02/14 23:45:01: Tom: Ja
With a little help of the regex above, I'm creating an object via this code:
var match;
while( match = regex.exec(chat)) {
messages.push({
date: match[1],
time: match[2],
name: match[3],
message: match[4]
});
}
Sometime the date doesn't look like dd/mm/yy but rather like dd-mm-yyyy or dd-mm-yy.
Whichever is the good match I want to parse that into the date property. but when adding multiple regex to match[1] the code seems to fail.
dd/mm/yy,dd-mm-yyyyanddd-mm-yy?