Here is a valid regex:
(https?:)\/\/.*(jpg|gif|png)
That will only match the "image" url. You can play around with it online here: http://regex101.com/
Edit
Basically, your Regex was not only invalid, but too convoluted. You had a sub-group for the "s" on "https", which wasn't needed according to the problem you proposed. Also, you had the OR operand trying to separate the http part and the rest of the url, which made no sense..., lastly, you were grouping the text between ":" and the dot ".", which again, according to your problem description it wasn't needed.
Hope that helps
Edit 2
Ok, so I don't know how exactly the replacement is being done, you're not using your code, you're using a page for that, but here is how you should be doing it:
"http://dfdkdlkdkldkldkldl.jpg".replace(/(https?:)(\/\/.*)(jpg|gif|png)/, "lalala$2$3")
Note that the RegEx changed to: (https?:)(\/\/.*)(jpg|gif|png)
If you try it with the other url: "http://fflffllkfl".replace(/(https?:)(\/\/.*)(jpg|gif|png)/, "lala$2$3")
it won't replace anything.