const regex = /(?:[^,]*\,){9}(.*?)\,/;
// Alternative syntax using RegExp constructor
// const regex = new RegExp('(?:[^,]*\\,){9}(.*?)\\,', '')
const str = `<13>Apr 20 16:19:36 SERVERNAME.domain.net 1,2021/04/20 16:19:36,013244444796,THREAT,data,2049,2021/04/20 16:19:36,1.1.1.1,2.2.2.2,3.3.3.3,4.4.4.4,FWRULE NAME,,,sharepoint-online-uploading,vsys1,fwrulename,zone,protocol.stuff,ethernet1/1,SourceOS,2021/04/20 16:19:36,34916,1,49538,443,11070,443,0x1406000,tcp,alert,"'FILE_01.docx'",DataPattern-Conf(60004),computer-and-internet-info,low,client-to-server,69181231233089036,0xa000000000000000,100.0.0.0-100.255.255.255,United States,0,,0,,,3,,,,,,,,0,13,14,35,11,,SERVERNAME,,,,,0,,0,,N/A,unknown,AppThreat-0-0,0x0,0,424949495,`;
// Reset `lastIndex` if this regex is defined globally
// regex.lastIndex = 0;
let m;
if ((m = regex.exec(str)) !== null) {
// 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