$re = '/^[\d.]+\s-\s\[[^\]]+\]\s"[^"]+"\s\["[\w=-]+"\s:\s"[\w=-]+"\]\s-\s"[^"]+"\s"[^"]+"$/m';
$str = '96.154.64.194 - [17/Sep/2015:10:17:30 +0000] "GET /?utm_source=gl&utm_medium=email&utm_campaign=kok HTTP/1.1" ["uid=210FDE53A08FF955138C3C6502030303" : "-"] - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0"
96.154.64.194 - [17/Sep/2015:10:17:30 +0000] "GET /?utm_source=gl&utm_medium=email&utm_campaign=kok HTTP/1.1" ["uid=210FDE53A08FF955138C3C6502030303" : "-"] - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0"91.154.64.194 - [17/Sep/2015:10:10:33 +0000] "GET /e.gif?chto_smotrish? HTTP/1.1" ["uid=210FDE53A08FF955138C3C6502030303" : "-"] - "-" "Mozilla/5.0 (Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.0"
remote_addr - [time] "query" ["uid" : "uid"] - "referrer" "user_agent"';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php