I want to replace my images that ends with a.jpg and b.jpg with c.jpg.
My code is as follows:
$(".test").each(function() {
var src = $(this).attr("src"){
if(src.match(/a.jpg$/)){
src.replace("a.jpg", "c.jpg");
} else if (src.match(/b.jpg$/)){
src.replace("b.jpg", "c.jpg");
}
$(this).attr("src", src);
});
but it is complicated.. how can i do this using regex?