const regex = /\"Id\":"(\d+)","LocalTime":"(\d+)"/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('\\"Id\\":"(\\d+)","LocalTime":"(\\d+)"', 'gm')
const str = `2020-06-05 01:00:33.919 INFO [Thread-261246][HClient.java:256] - post successefully
2020-06-05 01:00:33.920 INFO [Thread-261246][HClient.java:257] - {"ResponseStatusListObject":{"ResponseStatusObject":[{"RequestURL":"/VIID/Faces","StatusCode":"0","StatusMessage":"正常","Id":"31010713011328005232","LocalTime":"20200605005843"}]}}
2020-06-05 01:00:33.920 INFO [Thread-261246][PutuoHandle.java:104] - list send end, listSize:6, sendTime:757ms
2020-06-05 01:00:34.160 INFO [Thread-261248][HClient.java:256] - post successefully
2020-06-05 01:00:34.160 INFO [Thread-261248][HClient.java:257] - {"ResponseStatusListObject":{"ResponseStatusObject":[{"RequestURL":"/VIID/Faces","StatusCode":"0","StatusMessage":"正常","Id":"31010712011328005082","LocalTime":"20200605010212"}]}}
2020-06-05 01:00:34.196 INFO [Thread-261247][HClient.java:256] - post successefully
2020-06-05 01:00:34.196 INFO [Thread-261247][HClient.java:257] - {"ResponseStatusListObject":{"ResponseStatusObject":[{"RequestURL":"/VIID/Faces","StatusCode":"0","StatusMessage":"正常","Id":"31010712011328005082","LocalTime":"20200605010240"}]}}
2020-06-05 01:00:34.196 INFO [Thread-261247][PutuoHandle.java:104] - list send end, listSize:5, sendTime:954ms
2020-06-05 01:00:34.323 INFO [Thread-261248][HClient.java:256] - post successefully
2020-06-05 01:00:34.323 INFO [Thread-261248][HClient.java:257] - {"ResponseStatusListObject":{"ResponseStatusObject":[{"RequestURL":"/VIID/Faces","StatusCode":"0","StatusMessage":"正常","Id":"31010713011328005232","LocalTime":"20200605005843"}]}}
2020-06-05 01:00:34.510 INFO [Thread-261248][HClient.java:256] - post successefully
2020-06-05 01:00:34.510 INFO [Thread-261248][HClient.java:257] - {"ResponseStatusListObject":{"ResponseStatusObject":[{"RequestURL":"/VIID/Faces","StatusCode":"0","StatusMessage":"正常","Id":"31010711011328005078","LocalTime":"20200605010240"}]}}
2020-06-05 01:00:34.510 INFO [Thread-261248][PutuoHandle.java:104] - list send end, listSize:5, sendTime:1464ms
2020-06-05 01:00:48.939 INFO [Timer-0][PutuoHandleThread.java:29] - area=>PT_AREA cameraType=>HK_TP groupCount=>3
2020-06-05 01:00:48.939 INFO [Timer-0][DbUtil.java:118] - getLastMaxId, cameraType:HK_TP, area:PT_AREA
2020-06-05 01:00:48.940 INFO [Timer-0][DbUtil.java:129] - sql=SELECT maxid FROM t_flag_info WHERE cameraType = ? AND area = ?, 1:HK_TP, 2:PT_AREA`;
// 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