You can try and adapt something like this:
$pattern = '~(?<id>\d++)' . '\s++'
. '(?<datetime>\d{4}-\d{2}-\d{2}\s++\d{2}:\d{2}:\d{2})' . '\s++"'
. '(?<useragent>[^"]++)' . '"\s++'
. '(?<ip>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})' . '\s++'
. '(?<name>\S++)' . '\s++'
. '(?<response>[A-Z]++)' . '\s++'
. '(?<country>[A-Z]{2,3})' . '\s++'
. '(?<title>(?>[^h\s]++|\s*+(?>h(?!ttp://))?|\s++)+)' . '\s++'
. '(?<url>\S++)' . '\s++'
. '(?<search>\S++)~';
preg_match_all($pattern, $subject, $matches, PREG_SET_ORDER);
foreach($matches as $match) {
echo '<br/>id: ' . $match['id'] . '<br/>datetime: ' . $match['datetime']
. '<br/>user agent: ' . $match['useragent'] . '<br/>ip: ' . $match['ip']
. '<br/>name: ' . $match['name'] . '<br/>response: ' . $match['response']
. '<br/>country: ' . $match['country'] . '<br/>title: ' . $match['title']
. '<br/>url: ' . $match['url'] . '<br/>search: ' . $match['search']
. '<br/>';
}
Notice: you can put all the fields you expect in an array and reduce the size of code.