$re = '/(?<a1>\d{10})_(?<a2>\d{10})_(?<a3>\d{10})_(?<a43>\d{10})_(?<a5>\D{4})_(?<a6>\d{2}).(?<a7>\d{2}).(?<a8>\d{4})_(?<a9>\D{2})_(?<a10>\d{2}).(?<a11>\d{2}).(?<a12>\d{4})_(?<a13>\d+).(?<a14>\D{3})/';
$str = '2016001597_0002541747_0002581681_0054699343_From_07.31.2016_To_07.31.2016_2.PDF';
preg_match($re, $str, $matches, PREG_OFFSET_CAPTURE, 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