moll 2011-12-21
var reg=/<img\s+.*?src=(?:'(.+?)'|"(.+?)")\s*.*?(?:>|\/>)/igm var strXml ="sdfdfsadf <img src='xx/aa.jpg'/>sdfsdfsdf<img src='gg.jpg'/>sdfsdfsd<img size='19' src='cgg.jpg' n='20'>"; var result = []; var match; while( match=reg.exec(strXml) ){ result.push(match[0],match[1]); } alert(result);