3v4l.org

run code in 300+ PHP versions simultaneously
<?php $strings = [ '141.243.1.172 [29:23:53:25] "GET /Software.html HTTP/1.0" 200 233', '[29:23:53:25] "GET /Software.html HTTP/1.0" 200 233', '"GET /Software.html HTTP/1.0" 200 233' ]; $pattern = '/(^.*?)?(\[[0-9]+:[0-9]+:[0-9]+:[0-9]+\] )?(".+?") ([0-9]+) ([0-9-]+)/'; foreach ($strings as $string) { preg_match($pattern, $string, $matches); print_r($matches); }
Output for 7.1.25 - 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.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.14
Array ( [0] => 141.243.1.172 [29:23:53:25] "GET /Software.html HTTP/1.0" 200 233 [1] => 141.243.1.172 [2] => [29:23:53:25] [3] => "GET /Software.html HTTP/1.0" [4] => 200 [5] => 233 ) Array ( [0] => [29:23:53:25] "GET /Software.html HTTP/1.0" 200 233 [1] => [2] => [29:23:53:25] [3] => "GET /Software.html HTTP/1.0" [4] => 200 [5] => 233 ) Array ( [0] => "GET /Software.html HTTP/1.0" 200 233 [1] => [2] => [3] => "GET /Software.html HTTP/1.0" [4] => 200 [5] => 233 )

preferences:
163.79 ms | 409 KiB | 5 Q