JSFiddle - React, Tailwind, and code Playground

HTML

<img src="http://site.com/some/category/thread_17.jpg" />
<img src="http://site.com/other/thread_17/test.jpg" />

JavaScript

var src = $('img').filter(function() {
      return $(this).attr('src').match(/\/thread_[^\/]*$/)
    }).last().attr('src');    
    alert(src);