$re = '/filename="Myfile\.pdf"\s*(\S.*(?:\n\S.*)*)/m';
$str = '--------------A5B0A8B4F69F8BD959B758D0
Content-Type: application/pdf;
name="Myfile.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="Myfile.pdf"
JVBERi0xLjQKJeLjz9MKMyAwIG9iago8PC9UeXBlL1hPYmplY3QvQ29sb3JT
ZWI0ODRmNDE1ZDE0YmIyZmU2YjAzZDMzNjU+PGU5MDFiZTMzY2FlOTY4ZDM2
NmFmOGNhOTUxNTE0Nzk0Pl0vSW5mbyAyMyAwIFIvU2l6ZSAyND4+CnN0YXJ0
eHJlZgoyMzg2NgolJUVPRgo=
--------------A5B0A8B4F69F8BD959B758D0--
--------------A5B0A8B4F69F8BD959B758D0
Content-Type: application/pdf;
name="Myfile.pdf"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="Myfile.pdf"
JVBERi0xLjQKJeLjz9MKMyAwIG9iago8PC9UeXBlL1hPYmplY3QvQ29sb3JT
ZWI0ODRmNDE1ZDE0YmIyZmU2YjAzZDMzNjU+PGU5MDFiZTMzY2FlOTY4ZDM2
NmFmOGNhOTUxNTE0Nzk0Pl0vSW5mbyAyMyAwIFIvU2l6ZSAyND4+CnN0YXJ0
eHJlZgoyMzg2NgolJUVPRgo=
--------------A5B0A8B4F69F8BD959B758D0--';
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