我有一個HTML模板是這樣的:PHP的preg_match圖像
<div class="cont">
<div class="...">
<p>...<p>
<img alt="" class="popup" src="DESIRED IMAGE LINK" style="..." /></p><p>...</p>
....
,我想提取「所需的圖像LINK」的「」標籤內,我目前使用這樣的:
$pattern = '<div class="cont">.*?src=["\']?([^"\']?.*?(png|jpg|jpeg|gif))["\']?/i';
if (preg_match($pattern, $content, $image))
.....
但它不工作,錯誤的是:
warning: preg_match() [function.preg-match]: Unknown modifier '.'
我怎樣才能解決這個問題?由於
完美的作品!謝謝 – Alvins