const regex = new RegExp('(?(?=\\([^()\\w]*[\\w.]+[^()\\w]*\\))\\([^()\\w]*([\\w.]+)[^()\\w]*\\)|.)(?=[^{]*\\})
|
(?<!\\()(\\b\\w+\\b)(?!\\()|ok', '')
const str = `Schedule Schedule{id=45345, name=Real Time Positions, filterType=T0, reportId=372, accFilterId=200779, toEmailAddresses=[], ccEmailAddresses=[], bccEmailAddresses=[], ftpDestinations=[FileTransferDestination{protocol=FTP, server=iftp-prod.na.newedge.int, port=21, username=ITEC-MKT-DAR-PULS3-PRD@USA, password=<63a1120>, path=/USA/Root/Customers/EAGLE_SEVEN/NEW_PULSE}], formats=[CSV], sendBlankReports=false, dfaTag=false, sendIntegratedReports=false, pgp=false, pgpSign=false, cron=* 0/10 5-19 * * 1-7, tz=America/Chicago, rescCron=false, days=[], valid=true, fmtOpts=FormattingOptions{dateFormat=null, useCsvQuotes=false, quote=null, csvSep=null, csvHeader=true, csvFooter=false, csvTextDelim=null}, brand=null, compressionMode=CompressionMode{strategy=NEVER, type=ZIP, multipleFiles=false, useSubfolder=false}, businessDateInFilename=false, failureEmails=ashley.tambunan@newedge.com,matt.douglas@newedge.com, testMode=false, testEmails=null, emailSubj=null, emailBody=null, pgpBeforeCompression=true, reportServer=BO, lastNDays=0, useDateInTimeZone=false, marketId=null} finished successfully"`;
// 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