正则表达式获取内容类型边界


regexp get content type boundary

如何获取此标头中的边界?

$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

试试这个

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

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

输出

9B095B5ADSN=_01D16F24CC6015F600AB1926COL004?MC5F18.ho
preg_match('/boundary=(.*)/', $header, $match);