替换掉一段内容里所有的img标签
var
s =
'<img src="xxxx.jpg" alt="">afaf<img src="xxxx.jpg" alt="">'
;
s = s.replace(/(<img[\s\S]+?)src=([
'"][^'
"]+)[
'"]/ig, "$1 src='
1.jpg'");
alert(s)
var
s =
'<img src="xxxx.jpg" alt="">afaf<img src="xxxx.jpg" alt="">'
;
s = s.replace(/(<img[\s\S]+?)src=([
'"][^'
"]+)[
'"]/ig, "$1 src='
1.jpg'");
alert(s)