JSFiddle - React, Tailwind, and code Playground

HTML

<img src="http://example.ru/01/kmg05-300x214.jpg" class="attachment-portfolio-three" alt="kmg05" />
<img src="http://example.ru/01/kmg0675-300x214.jpg" class="attachment-portfolio-three" alt="kmg05" />
<img src="http://example.ru/01/kmнеg05-300x214.jpg" class="attachment-portfolio-three" alt="kmg05" />

JavaScript

$(document).ready(function () {
    var img$ = $('.attachment-portfolio-three');
    var str = "-300x214";
    img$.each(function () {
        var source = $(this).attr('src');
        if (source.toLowerCase().indexOf(str) >= 0) {
            source = source.replace(str, "");
            $(this).attr("src", source);
        }
    });
});