我想第一個src屬性,我用這正則表達式,但它刮所有src屬性:讓正則表達式匹配只有一次
(?<=src=").*?(?=")
例子:
<img src="http://ia.media-imdb.com/images/M/[email protected]@._V1_SY317_CR0,0,214,317_AL_.jpg" />
<img src="http://ia.media-imdb.com/images/M/[email protected]_V1_SX86_CR0,0,86,86_AL_.jpg" />
<img src="http://ia.media-imdb.com/images/M/[email protected]_V1_SY86_CR33,0,86,86_AL_.jpg" />
<img src="http://ia.media-imdb.com/images/M/MV5BMTAxNTAwMTg0ODReQTJeQWpwZ15BbWU4MDMzNDE2NDMx._V1_SY86_CR33,0,86,86_AL_.jpg" />
什麼是你期望的輸出?你正在運行哪種語言? – 2014-11-21 09:09:18
@AvinashRaj:first src attribute =>'http://ia.media-imdb.com/images/M/MV5BMTY3NjY0MTQ0Nl5BMl5BanBnXkFtZTcwMzQ2MTc0Mw @@ ._ V1_SY317_CR0,0,214,317_AL_.jpg' – 2014-11-21 09:10:01