Help With Button Script-Change part of filename

I want to create a button to do the following.

I will select multiple files before clicking the button. When I click the button it should prompt me for a string. When the string is entered the button script will check each of the selected file's names looking for the FIRST hashtag (#) character. It will replace the part of the filename for each selected file between the FIRST hashtag and the FIRST dash (-) with the text that was inputted at the prompt. Each file name that is selected will have exactly 2 hashtag characters.

Selected file name is: AAAA#1234#CCCC-DD-EE.txt
I input: BBB#xxx
The file name will be changed to: AAAA#BBB#xxx-DD-EE.txt

Thank you.


Rename REGEXP PATTERN="(.*?#).*?(-.*)" TO="\1{dlgstring|Enter String}\2"
1 Like

I looked at that short string and thought it couldn't possibly do all that I wanted. But IT DID! Thank you for your help.