так чтоли?
alert(
'<img src="http://qwerty.com/12345.jpg" alt=""> <img src="http://qwerty.com/12345.jpg" alt=""> <img src="http://qwerty.com/12345.jpg" alt=""> <img src="http://qwerty.com/12345.jpg" alt="">'
.replace(/(<\s*img\s+src\s*=\s*['"]http:\/\/[\s\S]*?)\.jpg/gi, "$1/?access=1111.jpg")
)