3v4l.org

run code in 300+ PHP versions simultaneously
<?php $subject = "FH_189.90.192.12 2016-02-02 21:03:05 M CTAG COMPLD total_blocks=1 block_number=1 block_records=13 list of ONU state -------------------------------------------------------------------------------- ONUID AdminState OperState AUTH AUTHINFO ONUIP LASTOFFTIME 4 UP UP MAC c0-7e-40-48-4f-30 -- 2016-01-29 08:53:35 6 UP UP MAC c0-7e-40-48-4f-6f -- 2016-01-29 08:53:35 5 UP LOS MAC c0-7e-40-48-64-20 -- 2016-01-31 21:17:56 8 UP LOS MAC c0-7e-40-48-4f-5e -- 2015-10-01 10:21:55 9 UP UP MAC c0-7e-40-48-62-ce -- 2016-01-29 08:53:35 10 UP UP MAC c0-7e-40-48-4f-69 -- 2016-01-29 08:53:34 11 UP UP MAC c0-7e-40-48-4f-4d -- 2016-02-01 17:53:57 12 UP UP MAC c0-7e-40-48-4f-33 -- 2015-11-23 19:40:14 13 UP LOS MAC c0-7e-40-48-4f-7d -- 2015-10-01 10:22:05 14 UP UP MAC c0-7e-40-48-4f-28 -- 2016-01-29 08:53:34 15 UP UP MAC c0-7e-40-48-4f-e5 -- 2016-01-29 08:53:33 16 UP UP MAC c0-7e-40-48-4f-af -- 2016-01-29 08:53:34 17 UP UP MAC c0-7e-40-48-4f-91 -- 2015-10-01 10:22:13 -------------------------------------------------------------------------------- ;"; $pattern = "/(?P<id>\w+)\d{1,}\s(UP)\s(UP|LOS)\s(MAC)\s\w{2}-\w{2}-\w{2}-\w{2}-\w{2}-\w{2}\s--\s\w{4}-\w{2}-\w{2}\s\d{2}:\d{2}:\d{2}/"; preg_match($pattern, $subject, $matches); print_r($matches);
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
Array ( [0] => 10 UP UP MAC c0-7e-40-48-4f-69 -- 2016-01-29 08:53:34 [id] => 1 [1] => 1 [2] => UP [3] => UP [4] => MAC )

preferences:
226.02 ms | 404 KiB | 330 Q