let src = str.match(/<img\s+(.*?)src='">/g) let srcs = src.map(item=>{ let k= item.match(/src='"['"]/)[1] return k }) srcs = srcs?srcs:[]