3v4l.org

run code in 300+ PHP versions simultaneously
<?php $txt = "resultCode:NoOp errorMessage:null processMessage:2014-08-08 02:18:01:659 INFO begin appName=ixp_app appVersion=2012_11_v01 integrationCode= clientId=999999 userName=autosuggest1 docId=12963337 docType=RFQ recipientId=58992 encodingTypeCode=UTF-8 2014-08-08 02:18:01:659 DEBUG Opening connection to the database 2014-08-08 02:18:01:660 DEBUG Validating client's account 2014-08-08 02:18:01:668 DEBUG Reading original document details from database 2014-08-08 02:18:01:668 DEBUG Reading Header from Database 2014-08-08 02:18:01:671 DEBUG Reading Line Items from Database 2014-08-08 02:18:01:673 DEBUG Reading Party Contacts from Database 2014-08-08 02:18:01:675 DEBUG Constructing Interchange 2014-08-08 02:18:01:675 DEBUG Constructing Request For Quote 2014-08-08 02:18:01:678 DEBUG Constructing Dates 2014-08-08 02:18:01:678 DEBUG Constructing References 2014-08-08 02:18:01:678 DEBUG Constructing Comments 2014-08-08 02:18:01:679 DEBUG Constructing Parties 2014-08-08 02:18:01:679 DEBUG Constructing Line Items 2014-08-08 02:18:01:680 DEBUG Saving original document content to file - raw 2014-08-08 02:18:01:705 INFO Found 1 possible RFQ matches with a Reference No.: 14/440 that was forwarded by Match Buyer 11107 to Supplier 58992 2014-08-08 02:18:01:705 INFO RFQ with Internal Ref No.: 12884046 2014-08-08 02:18:01:706 INFO RFQ 12963337 will now be compared with the list of possible RFQ matches 2014-08-08 02:18:01:706 INFO Comparing RFQ 12963337 with RFQ 12884046 2014-08-08 02:18:01:706 DEBUG Reading Header from Database 2014-08-08 02:18:01:708 DEBUG Reading Line Items from Database 2014-08-08 02:18:01:720 DEBUG Reading Party Contacts from Database 2014-08-08 02:18:01:727 DEBUG Constructing Interchange 2014-08-08 02:18:01:728 DEBUG Constructing Request For Quote 2014-08-08 02:18:01:730 DEBUG Constructing Dates 2014-08-08 02:18:01:730 DEBUG Constructing References 2014-08-08 02:18:01:731 DEBUG Constructing Comments 2014-08-08 02:18:01:731 DEBUG Constructing Parties 2014-08-08 02:18:01:732 DEBUG Constructing Line Items 2014-08-08 02:18:01:733 DEBUG Doc Changed on //Interchange/RequestForQuote/LineItem/@Description 2014-08-08 02:18:01:733 DEBUG Electric motor, Vertical mounted, Type- 4AP 71-45, 3phase, 440 Volts, 60 Hz, 0.29 KW, 0.8 Amp & 1656 RPM, Fan Motor, 3-phase, 440Volts, 0.8 Amp, 60 Hz, 0.29KW & RPM-1656 not equal to 2/2 way solenoid valve- servo assisted for emergency fire pump, Maker: Burkert, Details: 5281 A 13.0 NBR, MS, G 1/2, PNO 0.2 - 16 bar, 230 V, 50-60 Hz8 W, G 1/2, PNO 0.2-16 Bar 2014-08-08 02:18:01:733 DEBUG Committing database transaction 2014-08-08 02:18:01:733 DEBUG Closing connection to the database 2014-08-08 02:18:01:734 INFO end status=NOOP filename=999999_20140808021801_f90e96c9 elapsed=74ms fileContents:null "; $lines = explode(PHP_EOL, $txt); $messages = array(); foreach ($lines as $line) { // 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]; // now filter by the first word of the message if (!preg_match('/^(.*) .*$/', $message, $words)) { // no first word means only one word, skip it continue; } $word = $words[1]; if (in_array($word, array( 'opening', 'validating', 'reading', 'constructing', 'saving', 'found', 'rfq', 'comparing', 'committing', 'closing', 'end' ))) { // skip know technical message continue; } $messages[] = $message; } print_r($message);

preferences:
56.22 ms | 402 KiB | 5 Q