var s = '<img alt="" src="child.jpg" style="width: 640px; height:417px;">'.replace(/style=".+?"/, 'style="width:100%;"'); alert(s);