Php regexp获取内容类型边界

Php regexp获取内容类型边界,php,regex,Php,Regex,如何获取此标题中的边界 $header = 'Content-Type: multipart/report; report-type=delivery-status;'."\n" .' boundary="9B095B5ADSN=_01D16F24CC6015F600AB1926COL004?MC5F18.ho"'; preg_match('/Content-Type:(.*)boundary="([^\"]+)"/i', $header, $match); print_r($match

如何获取此标题中的边界

$header = 'Content-Type: multipart/report; report-type=delivery-status;'."\n"
.'    boundary="9B095B5ADSN=_01D16F24CC6015F600AB1926COL004?MC5F18.ho"';

preg_match('/Content-Type:(.*)boundary="([^\"]+)"/i', $header, $match);
print_r($match);
输出

9B095B5ADSN=_01D16F24CC6015F600AB1926COL004?MC5F18.ho
9B095B5ADSN=_01D16F24CC6015F600AB1926COL004?MC5F18.ho
试试这个

preg_match('/boundary="(.*?)"/i', $header, $match);

输出


使用
s
修改器。演示:
9B095B5ADSN=_01D16F24CC6015F600AB1926COL004?MC5F18.ho
preg_match('/boundary=(.*)/', $header, $match);