How to Remove Everything before given 1st Character?

My file name is: IwantToRemoveThisPart - Title - Artist - Etc
Wanted file name: Title - Artist - Etc

  1. The short hyphen number is not equal in all file name some file has random number of short Hyphen, some file has 2 short hyphen, some has 3 or 4
  2. there could be another sign like Undersocre _ or ~ So I need to Input the Character with in a Dialog box

This button code can remove everything before given character But the problem is This button don't count from left 1st character, it's count the last character of the file name, & it's dont remove the character and the Space after character, as you can see in my example file name IwantToRemoveThisPart - if I input the short hyphen character in the dialog box then it should be remove the space short hyphen space also.

Rename REGEXP PATTERN ".*({dlgstring|Enter string to remove up to}.*)" TO "\1" AUTORENAME IGNOREEXT 

It's easier to do this using the Rename window.

Make sure "Use preview list to build macros" is turned on in it, and then simply click on something in the New Name column and edit it. The same edits will be applied to all the other filenames.

But if your only issue is the regex not removing spaces, just put a space into the regex after the *. Assuming you always want to remove that space.

I can't Use the Rename Window for that. Because The unwanted character number are not equal for every Selected files.
example
1st file name IwantToRemoveThisPart - Title - Artist - Etc
2nd file name IwantToRemove - Title _ Artist - Etc
3rd file name Iwant RemoveThisPart - Title Artist - Etc
so the character number is NOT equal for every selected files which I want to remove, So I have to pick some regex for capture the 1st short hyphen then should tell the button to delete everything before the 1st short hyphen capture group

Use the Rename dialog, and save a preset with:

Mode - Regular Expressions
Old name - .*? - (.*)
New name - \1

Then just load the preset and edit the - character if you want something else.

You'll also be able to check in the preview list that it does the correct thing before modifying your filenames, which is important. Some separators will need escaping if you want to use them inside a regex. For example, you would have to be careful if you needed to use ( as a separator, because it has special meaning in regular expressions. You would have to type \( instead of just ( for it.

With the Rename preview visible, you'll notice if something is about to go wrong before you apply the change to all your files, which won't happen if you do everything via a single dialog prompt and command that doesn't open the Rename dialog.

You could fully automate things using a script instead, but this should be good enough if you don't want to or can't write that yourself.

1 Like

:face_holding_back_tears: :face_holding_back_tears: :face_holding_back_tears:
I will try to write a script plz give me little help where I stack
for now I understand your regex code how this code works, so that I have changed my old button code like that & it's works fine for now

Rename REGEXP PATTERN ".*?({dlgstring|Enter string to remove up to}) (.*)" TO "\2" AUTORENAME IGNOREEXT 

I don't think it's a good idea to do it like that, because you could type something in that messes up the regex, and you'd only know it was a problem after all your files had been renamed.

Better to use the Rename dialog which will show you what's going to happen before anything is done.