const regex = /([\d:\.]*?)\s+?(\d+?)\s+?([\d:\.]*?)\s+?(\d+?)\s+?(\d+?)\n/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('([\\d:\\.]*?)\\s+?(\\d+?)\\s+?([\\d:\\.]*?)\\s+?(\\d+?)\\s+?(\\d+?)\\n', 'gm')
const str = `concept 2.
View Detail
2000m
Mar 31 2018
time meter 500m in
6:48.9 2000 1:42.2 45
1:47.2 500 1:42.2 45
1:42.2 1000 1:42.2 45
1:42.2 1500 1:42.2 45
1:42.2 2000 1:42.2 45
Units
Display`;
let m;
while ((m = regex.exec(str)) !== null) {
// This is necessary to avoid infinite loops with zero-width matches
if (m.index === regex.lastIndex) {
regex.lastIndex++;
}
// The result can be accessed through the `m`-variable.
m.forEach((match, groupIndex) => {
console.log(`Found match, group ${groupIndex}: ${match}`);
});
}
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for JavaScript, please visit: https://developer.mozilla.org/en/docs/Web/JavaScript/Guide/Regular_Expressions