匹配Apache访问日志行正则表达式php

I need to parse an apache log line:

Here's what I've tried:

$line = '136.243.36.82 - - [30/Apr/2016:17:00:20 -0700] "GET /Socialist/06/0609Educ.htm HTTP/1.1" 200 3093 "-" "Mozilla/5.0 (compatible; BLEXBot/1.0; +http://webmeup-crawler.com/)" "redlug.com"';

$regex = '/^(\S+) (\S+) (\S+) \[([^:]+):(\d+:\d+:\d+) ([^\]]+)\] \"(\S+) (.*?) (\S+)\" (\S+) (\S+) "([^"]*)" "([^"]*)"$/';

preg_match($regex, $line, $match);

die(var_dump($match));

But it always returns an empty array.

Your regex wasn't matching last element. This is corrected regex.

^(\S+) (\S+) (\S+) \[([^:]+):(\d+:\d+:\d+) ([^\]]+)\] \"(\S+) (.*?) (\S+)\" (\S+) (\S+) "([^"]*)" "([^"]*)"\s+"([^"]+)"$

Regex Demo