$re = '/(?(?=\([^()\w]*[\w.]+[^()\w]*\))\([^()\w]*([\w.]+)[^()\w]*\)|.)(?=[^{]*\})
|
(?<!\()(\b\w+\b)(?!\()|ok/';
$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"';
preg_match($re, $str, $matches, PREG_OFFSET_CAPTURE, 0);
// Print the entire match result
var_dump($matches);
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 PHP, please visit: http://php.net/manual/en/ref.pcre.php