JSFiddle - React, Tailwind, and code Playground
by Raynos
JavaScript
file = "12:00 fooooo bar bar bar bar \n 12:01 fooo baz baz baz baz";
var fileTexts = [file];
var regex = new RegExp("(\\d\\d:\\d\\d)(.*)");
for (var i = 0; i < fileTexts.length; i++) {
var text = fileTexts[i];
var records = text.split("\n");
for (var j = 0; j < records.length; j++) {
var match = regex.exec(records[j]);
addToTimestamps(match[1], match[2], i);
}
}
function addToTimestamps(timestamp, text, currFileCount) {
console.log(arguments);
// implement it.
}