Use the command Select SIMILARBASE
any file with the same name stem (everything ignoring the extension part) as a selected file will also be selected.
If needed: How to use buttons and scripts from this forum
If you need it to only select certain extensions, you could do that by adding a second line which deselects anything that isn't one of the extensions you want.