$re = '/^UVM_[A-Z]*|build.+?(?=\()|[0-9]+(?=\))|(?<=@ )[0-9]+|(?<= \[).*?(?=\]\s)|(?<=: ).*?(?= \[)|((?<=\]).*())/m';
$str = 'UVM_INFO build/vcs-rtl-default-queue/sbu_tb/sv/SbuSbMonitor/bmiTransRecorder.sv(495) @ 4725749: reporter@@BMI_TXN [BMI_RECORDER] @ 4725749 [BMI ID: 95] bmiDone=0 nbuId=0xa biuId=0x0 devRst=0 m_error=0 type=write_data snpId=0x5 txnId=0x1c124 devTag=0x0 wrIdx=0x0 addr=0x300ac len=0x4 space=3 dev_cmd=unknown data=0x25c20d74288413f2387891d50000000000000119ec331542f7518539c4101a2d7a0ccdbfd7837f2f918651f3dda1de0c54fb652228b2c1ced2ae6bd16dd302dd lv=0x0
UVM_INFO build/vcs-test_bmi_rsp-default-queue/sbu_tb/sv/SmmuModel/tlb_cache.sv(130) @ 264291: tlb_cache_h [tlb_cache] TLB_CACHE:: BEFORE pagesize[ 310][ 0] = 0 AFTER - pagesize[ 310][ 0] = 1
';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 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