$re = '/ .+\.rtf /';
$str = 'rxn of glucose.png Screen Shot 2017-07-17 at 8.25.30 AM.png Screen Shot 2017-08-18 at 11.23.21 AM.png Screen Shot 2017-08-18 at 11.36.27 AM.png Screen Shot 2017-08-19 at 6.06.19 AM.png SSS.rtf Untitled 2.rtf Untitled 3.rtf Untitled 4.rtf Untitled.rtf';
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