JSFiddle - React, Tailwind, and code Playground

HTML

<div class="post-outer">
<img src="https://1.bp.blogspot.com/-9h_QVOCOX1w/XvnuC9SucSI/AAAAAAAABJo/roFOy4Tgs64wSDtI9-dC9WyglJJdPz3fACK4BGAsYHg/w100/image.png"/>
</div>

JavaScript

// The RegEx target everything between the two last slashes
$('.post-outer img').attr('src').replace(/[^\/]+(?=\/[^\/]*$)/, 'w270');