Pair renaming - SRT extensions? double extensions?

I have a series of movies (.MP4 or .MKV) with various subtitle files that have single or double extensions .SRT, .EN.SRT or .SPA.SRT (the last two add a language extension.

I tried using the pair renaming option, and it doesn't seem to work with MP4 and SRT files, let alone the double-extension versions.

I've had to resort to a two-step process that uses the List Methods to grab all the MP4 filenames, then load all the SRTs by extension and rename them to match the MP4 file.

I was hoping the pair's renaming would work for single SRTs, but it doesn't seem to recognize them.
Welcome Chad,

Plain SRT files work fine for me, provided they are in the same folder, per
https://www.advancedrenamer.com/user_guide/v4/filepairs

However, ones with compound extensions do not because all but the last period are considered part of the filename. (A feature of the Windows OS)

Obviously, this is no help for you, but you can work around this with a Script renaming method.
https://www.advancedrenamer.com/user_guide/v4/method_script

1) Create a new script method **AFTER all other renaming methods that you wish to use**.

2) Set "Apply to:" to "Name and extension".

3) Paste this next code in the "Pre batch script" and apply it:

//-------------------------------------------------------
// Pre batch script
//-------------------------------------------------------
nameMap = {};
mstrFileTypes = ["video", "image"]; // Key off of item.mediaType, rather than a finicky list of extensions.

//-- Capture the new names of "Master"/"key" files. Here assumed to be main media files
for (let J = 0, L = app.itemCount; J < L; J++) {
let item = app.getItem (J);
if (mstrFileTypes.includes (item.mediaType) ) {
nameMap[item.name] = item.newBasename;
}
}
//-------------------------------------------------------


Then paste the following code in the "function(index, item)" block and apply it.

//-------------------------------------------------------
// "function( index, item)" script
// This one must apply to "Name and extension".
//-------------------------------------------------------
let baseName = item.name.replace (/^(.+?)\..*$/, "$1"); // Assume that the true filename has no periods.
let fileExtension = item.ext;
if (/\./.test (item.name) ) {
//-- Assume any periods in the "file name" must actually be part of the "extension".
fileExtension = item.name.replace (/^.+?(\..*)$/, "$1") + item.ext;
}
let masterBaseName = nameMap[baseName];

if (masterBaseName) return masterBaseName + fileExtension;
//-------------------------------------------------------

This code works for me and works across subfolders too.

Regards,
Randy