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"'
# Print the match result
str.match(re) do |match|
puts match.to_s
end
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 Ruby, please visit: http://ruby-doc.org/core-2.2.0/Regexp.html