3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $txt = "resultCode:NoOp errorMessage:null processMessage:2014-08-01 23:39:01:992 INFO begin appName=ixp_app appVersion=2012_11_v01 integrationCode= clientId=999999 userName=autosuggest1 docId=12928265 docType=RFQ recipientId=63880 encodingTypeCode=UTF-8 2014-08-01 23:39:01:992 DEBUG Opening connection to the database 2014-08-01 23:39:01:993 DEBUG Validating client's account 2014-08-01 23:39:02:000 DEBUG Reading original document details from database 2014-08-01 23:39:02:000 DEBUG Reading Header from Database 2014-08-01 23:39:02:002 DEBUG Reading Line Items from Database 2014-08-01 23:39:02:004 DEBUG Reading Party Contacts from Database 2014-08-01 23:39:02:006 DEBUG Constructing Interchange 2014-08-01 23:39:02:007 DEBUG Constructing Request For Quote 2014-08-01 23:39:02:009 DEBUG Constructing Dates 2014-08-01 23:39:02:010 DEBUG Constructing References 2014-08-01 23:39:02:010 DEBUG Constructing Comments 2014-08-01 23:39:02:010 DEBUG Constructing Parties 2014-08-01 23:39:02:011 DEBUG Constructing Line Items 2014-08-01 23:39:02:011 DEBUG Saving original document content to file - raw 2014-08-01 23:39:02:025 INFO Match RFQ QOT Not Found. 2014-08-01 23:39:02:025 INFO There is no RFQ with a Reference No.: TBE140180 found within the last 60days that was sent by Buyer 10529 to Match Supplier 999999 that was forwarded by Match Buyer 11107 to Supplier 63880 2014-08-01 23:39:02:025 DEBUG Committing database transaction 2014-08-01 23:39:02:026 DEBUG Closing connection to the database 2014-08-01 23:39:02:026 INFO end status=NOOP filename=999999_20140801233901_d8aa3e22 elapsed=33ms fileContents:null "; $lines = explode(PHP_EOL, $txt); $userMessages= array(); foreach ($lines as $line) { //print $line . PHP_EOL . '---------' . PHP_EOL; // regexp is 'timestamp debug_level message' if (!preg_match( '/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}:\d{3} \w+ (.*)$/', $line, $matches )) { // top lines with no timestamp, safe to skip them continue; } $message = $matches[1]; $words = explode(' ', $message); if (empty($words)) { // single words are also skipped continue; } if (in_array(strtolower($words[0]), array( 'opening', 'validating', 'reading', 'constructing', 'saving', 'found', 'rfq', 'comparing', 'committing', 'closing', 'end' ))) { // skip know technical message continue; } $userMessages[] = $message; } print_r($userMessages);
based on X1Rvv
Output for 4.3.10 - 4.4.9, 5.0.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => Match RFQ QOT Not Found. [1] => There is no RFQ with a Reference No.: TBE140180 )
Output for 4.3.0 - 4.3.9, 5.0.0 - 5.0.1
Notice: Use of undefined constant PHP_EOL - assumed 'PHP_EOL' in /in/IgHak on line 36 Array ( )