$re = '/(?<=HTTP\/1.0"\s)(301)(?=\s5024)/m';
$str = '11.22.33.44 - - [17/Aug/2019:11:24:01 -0400] "GET /posts/posts/explore HTTP/1.0" 301 5024 "http://www.someurl.blah/faq.php" "Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_12_5) AppleWebKit/5310 (KHTML, like Gecko) Chrome/29.0.801.0 Safari/5310"
';
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