const regex = /\d\d.-?.\w.-?.\d\d/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('\\d\\d.-?.\\w.-?.\\d\\d', 'gm')
const str = `root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen-533 Berkshire 5 min 27-Jun-18 14:27 9.0 --- --- 0.08
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen-533 Berkshire 27-Jun-18 9.0 18.9 7.7 ---
root - ERROR - : 06/05/2019, 14:29:55 : -NR
root - ERROR - : 06/05/2019, 14:29:55 : -NR
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen 247 Brock Street North 27-Jun-18 13.0 19 7.6 ---
root - ERROR - : 06/05/2019, 14:29:55 : -NR
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen 245 Brock St N 5min 09-Jul-18 14:35 9.0 --- --- 12.1
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen 245 Brock St N 09-Jul-18 9.0 7.5 22.4 ---
root - ERROR - : 06/05/2019, 14:29:55 : -NR
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen-665 Cherry Dr 5min 21-Jun-18 11:04 8.0 --- 3.93
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen-665 Cherry Dr 21-Jun-18 8.0 7.7 ---
root - ERROR - : 06/05/2019, 14:29:55 : -NR
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen 1390 Christina Street North 10-Oct-18 16.0 7.6 ---
root - ERROR - : 06/05/2019, 14:29:55 : -NR
root - ERROR - : 06/05/2019, 14:29:55 : -NR
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen 140 Conrad St 09-Jul-18 9.0 7.6 21.6 ---
root - ERROR - : 06/05/2019, 14:29:55 : -NR
root - ERROR - : 06/05/2019, 14:29:55 : -NR
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen 763 Copland 27-Jun-18 13.0 19.3 7.6 ---
root - ERROR - : 06/05/2019, 14:29:55 : -NR
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen-560 Cromwell St 5th 09-May-18 13:37 12.0 --- 16.1
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen-560 Cromwell St 09-May-18 12.0 7.0 ---
root - ERROR - : 06/05/2019, 14:29:55 : -NR
root - ERROR - : 06/05/2019, 14:29:55 : -NR
root - ERROR - : 06/05/2019, 14:29:55 : -NR
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen 534 Davis Street 5min 30-Aug-18 14:34 17.0 --- 9.05
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen 534 Davis Street 30-Aug-18 --- 7.5 ---
root - ERROR - : 06/05/2019, 14:29:55 : -NR
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen-534 Devine St 5min 25-Jun-18 08:04 10.0 --- --- 0.05
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen-534 Devine St 25-Jun-18 10.0 6.6 18.4 ---
root - ERROR - : 06/05/2019, 14:29:55 : -NR
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen 845 Devine St-5 Min 26-Jun-18 12:43 8.0 --- --- 75 0.17
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen 845 Devine St 26-Jun-18 8.0 18.5 7.6 --- ---
root - ERROR - : 06/05/2019, 14:29:55 : -NR
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen 357 East St-5 26-Sep-18 09:04 19.0 --- 0.09
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen 357 East St 19.0 7.8 ---
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen 357 East St-1 26-Sep-18 09:34 19.0 --- 0.27
root - ERROR - : 06/05/2019, 14:29:55 : NR Kitchen 357 East St-2 26-Sep-18 09:34 19.0 --- 0.14
root - ERROR - : 06/05/2019, 14:29:55 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen 306 Elgin St 10-Oct-18 16.0 8.0 ---
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen 308 Elgin St-1 26-Sep-18 11:32 19.0 --- 6.47
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen-641 Elm Ave 09-May-18 12.0 6.7 ---
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen-267 Emma St 29-May-18 11.0 7.8 ---
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen-272 Emma St 24-May-18 11.0 7.3 ---
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen-278 Emma St 29-May-18 11.0 7.4 ---
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen-297 Emma St 24-May-18 11.0 7.3 ---
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen-301 Emma 24-May-18 11.0 7.2 ---
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen-248 Emma St 08-May-18 16.0 7.4 ---
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen-257 Emma St 5th 08-May-18 12:30 16.0 --- 1.21
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen-263 Emma St 07-May-18 16.0 7.8 ---
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen-273 Emma St 07-May-18 12:41 16.0 7.7 ---
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen-277 Emma St 08-May-18 16.0 7.8 ---
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen-281 Emma St 07-May-18 13:48 16.0 7.9 ---
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen-284 Emma St 08-May-18 16.0 7.8 ---
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen-291 Emma St 07-May-18 14:30 16.0 7.8 ---
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen-299 Emma St 08-May-18 16.0 7.6 ---
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen-300 Emma St 08-May-18 16.0 7.9 ---
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen-247 Emma St 09-May-18 12.0 7.9 ---
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen-288 Emma St 10-May-18 12.0 7.8 ---
root - ERROR - : 06/05/2019, 14:29:56 : -NR
root - ERROR - : 06/05/2019, 14:29:56 : NR Kitchen-303 Emma St 10-May-18 12.0 7.6 ---
root - ERROR - : 06/05/2019, 14:29:57 : -NR
root - ERROR - : 06/05/2019, 14:29:57 : NR Kitchen 320 Exmouth 12-Jul-18 8.0 21.9 7.6 ---
root - ERROR - : 06/05/2019, 14:29:57 : -NR
root - ERROR - : 06/05/2019, 14:29:57 : -NR
root - ERROR - : 06/05/2019, 14:29:57 : NR Kitchen 571 Flamingo DR 5 03-Oct-18 09:16 Curtis Salisbury 16.0 --- 0.07
root - ERROR - : 06/05/2019, 14:29:57 : NR Kitchen 571 Flamingo DR 03-Oct-18 Curtis Salisbury 16.0 7.9 ---
root - ERROR - : 06/05/2019, 14:29:57 : -NR
root - ERROR - : 06/05/2019, 14:29:57 : NR Kitchen 590 Flamingo 5min 14-Aug-18 15:04 12.0 --- --- 0.08
root - ERROR - : 06/05/2019, 14:29:57 : NR Kitchen 590 Flamingo 14-Aug-18 12.0 7.6 22.3 ---
root - ERROR - : 06/05/2019, 14:29:57 : -NR
root - ERROR - : 06/05/2019, 14:29:57 : NR Kitchen 122 Forsyth North 31-Jul-18 Curtis Salisbury 12.0 21.6 7.4 ---
root - ERROR - : 06/05/2019, 14:29:57 : -NR
`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
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