Firstly, there may be some formatting errors in your post, so I’m not sure if we are all seeing the code correctly. (Some of the text is italicized?) Also, when I pasted the code into Maya, the quotes came in as apostrophes, so some more text formatting weirdness.
Depending on your version of Maya, the f-strings may not be supported. Might try formatting the string the old way for testing in Maya.
For clarity, I will translate the formatting of your string to see what we have and why it fails.
jacket.d..jpg # regex pattern
jacket_shot_pants_d_.jpg # test string
While I am no expert in regular expressions, there are some things I’m spotting immediately. “.” matches any single character. You need to add a quantifier to allow for more characters to be considered. Between “jacket” and “d”, you need to allow more characters to match with “+”. And if you’re looking to match the “.” literally in “.jpg” you need to escape it with “\”. Furthermore, you may want to force the file extension match to only search the end of the test string with “$” so that you won’t match on “.jpg.exr” for example. And, you could run into “.jpeg” as well, so you can account for that by adding “e*”; the asterisk matches zero or more of the preceding character.
This should work. I grouped the file extension in parentheses. This will match “jacket”<anything>“d”<any single character>".jpg" or “.jpeg”
jacket.+d.(\.jpe*g)$
I would go event further and specify your file name separators. The above regex will match “jacket_shot_pants_dx.jpg” or “jacket_shot_pantedx.jpg” for example.
This might be best:
jacket_.+_d_(\.jpe*g)$
Anyway, try that.