const regex = /org.alluxio<name="*([a-zA-Z_\.]+)\.([0-9\.]+)"*,*[^:,\n]*><>(\w+)Rate/gm;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('org.alluxio<name="*([a-zA-Z_\\.]+)\\.([0-9\\.]+)"*,*[^:,\\n]*><>(\\w+)Rate', 'gm')
const str = `org.alluxio<name=Master.GetFingerprint.UFS:s3a:%2F%2Frzp-si-dashboard%2F.UFS_TYPE:s3, type=timers><>50thPercentile
org.alluxio<name=Master.registerMaster.User:alluxio
org.alluxio<name=Master.EmbeddedJournalSnapshotReplayTimer, type=timers><>50thPercentile
org.alluxio<name=Master.InodeCacheEvictions, type=counters><>Count
org.alluxio<name="Master.getConfigHash.User:trino:afd", type=counters><>Count
org.alluxio<name=Master.GetSpace.User:alluxio.UFS:s3:%2F%2Frzp-edh-prod%2Falluxio%2Falluxio-dev.UFS_TYPE:s3.fd, type=timers><>50thPercentile
org.alluxio<name=Master.GetSpace.User:alluxio.UFS:s3:%2F%2Frzp-edh-prod%2Falluxio%2Falluxio-dev.UFS_TYPE:s3.fd><>50thPercentile
org.alluxio<name=Master.JournalGainPrimacyTimer, type=timers><>50thPercentile
org.alluxio<name="Master.UfsSessionCount-Ufs:s3:%2F%2Frzp-prod-datum%2Fpa_sheets%2FXFinopsIncidentTracker%2FIncidentTracker"><>Count
org.alluxio<name=Worker.BytesReadRemoteThroughput.10.44.21.20, type=meters><>OneMinuteRate`;
// 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