如何从以下正则表达式PHP中获取值到我的变量中?

I need to parse a big log file to get the ipadress, datetime, source and client from all the records.

The following link with the regex works:

http://regex101.com/r/cG9tY7

Regex:

(?<ipAddress>.*?)\s-\s-\s\[(?<dateTime>.*?)\]\s\"GET\s(?<source>.*?)\"\s[0-9]+\s[0-9]+\s\"-\"\s\"(?<client>.*?)\"

Maybe the format is not ok for PHP ?

I open the file as such:

$filename = "access-streaming_small.log"
$file = popen("tac $filename", 'r');

If I use :

while ($line = fgets($file)) {
echo $line;
}

I get the full log file which is displayed ok.

I need to process it with regex so that I get variables of ipadress, datetime, source and client from all records contained in the log file. Bonus task: I need to filter results to get the most current details of the records generated in the last 10 minutes compared to current time.

Have you tried preg_match? Important are the '/ and /' else it won't work

preg_match('/(?P<name>\w+): (?P<digit>\d+)/', $str, $matches);