<script>
var str=‘<p><img style="width: 140px; height:
105px;" src="/ckfinder/userfiles/images/qi_cym.jpg"
data-cke-saved-src="/ckfinder/userfiles/images/qi_cym.jpg"></p><p><br></p>‘;
var reg = new RegExp("(<img.*src=\"\.*?\>)"); //正则表达式
str.match(reg);//从字符串str中查找src="/ckfinder/userfiles/images/qi_cym.jpg"这段字符串
var re = /src="([^"]*)"/g; //只查找 /ckfinder/userfiles/images/qi_cym.jpg
这段路径
alert(str.match(reg));
while (arr = re.exec(str)) {
alert(arr[1]);
}
</script>
原文地址:http://www.cnblogs.com/kevinge/p/3773672.html