Target image with substring in source

Target image with substring in source

I am trying to target an image that has a specific substring, Ex:  {{name-1-field}}  in it's src.  I'll be updating the src.

So if I have this:

<img src="../resources/{{name-1-field}}">

I tried a general search function to target the wrapping element:

$('*:contains("{{name-1-field}}"):last');

But I guess that only works for text nodes?  I'm not sure what would be the best way.

Also, is there a quick way to check the type of the wrapping element?  Ie. to make sure it's an image.