var re=/(<img src=["']?)(\S\.(jpg|gif|jpeg|png))(["']?.+>)/i
var str="<img src='1.jpg' width=5>"
alert(str.match(re)[2])