JSFiddle - React, Tailwind, and code Playground
HTML
<img src="http://www.rafaelalmeida.net78.net/exemplos/sopt/56952-src-img/100x150.png" class="thumb"/>
<img src="http://rafaelalmeida.net78.net/exemplos/sopt/56952-src-img/100x150.png" class="thumb"/>
JavaScript
$(document).ready(function() {
// Percore todas as imagens com a classe "thumb"
$("img.thumb").each(function() {
// Pega o caminho atual
var img_path = $(this).attr("src");
// Define o regex
var regex = /rafaelalmeida.net78.net\/exemplos\/sopt\/56952-src-img\/(.+).png/;
if (regex.test(img_path)) {
// Se o caminho da imagem bater com o regex...
// Especifica o tamanho atual
var size = img_path.match(regex)[1];
if (size == "100x150") {
// Se o tamanho for 100x150...
// Substitui o antigo caminho com o novo tamanho
var new_path = img_path.replace(size, "300x340");
// Atribui o novo valor ao atributo "src"
$(this).attr("src", new_path);
}
}
});
});