Removing a certain number of characters from left or right of Filename using Replace with Regular Expression

I would like the ask the community on how to remove X(or N, whichever works) amount of ANY TYPE OF characters from a filename
From the left side and then the expression that removes characters from the right side of the filename
I prefer to use the action:

Replace with Regular Expression
Regular Expression
(This is where the community comes in)
Replace Matches With

I found the two ways on how to do this online, but a dying hard drive crash have made those saved expressions (?) lost and now cannot find them anywhere on the internet.

I have read enough lecturing and berating to last a lifetime on why people shouldn't even bother with this.
I learned how to do this online YEARS ago and it is, for me, the most versatile.

Please no you should %artist% 1 part blah blah blah, please.

I can not thank you enough for your assistance on this ahead of time.

The HOURS (shudder I have been searching only to find posts of people being berated or asked why not do something else is frustrating.

To be clear
If the filename is:
I want it to be removed 3 spaces from the left DEFGHIJKLMNOPQRSTUVWXYZ.mp3
Then I'll also want to do 5 or 7 or how ever many

and then 4 or 5 or 7 or 10 spaces to the right? (I'll use 5 in this example)

If this sounds annoying, sorry. The amount of people not willing to answer this simple question is just frustrating.

The last one I tried was "$cutLeft(.,2)" but I know that wasnt what I used but wanted to try something before asknig on here.

Appreciate the help and thank you again.

Hi and welcome :slight_smile:

Not sure if I understand everything, but you can try the converter "Tag - Filename" with

to remove 3 characters from the left and

to remove 3 characters from the right.

You can also combine the two with

Added the $cutLeft(%_filename%,3) expression in Regular Expression and did nothing....
Is there a way to save it as an action?

Tag - Filename, found it, it did work!!! (YEAH) but if you dont mind, is there a way to create it as an action?

Not sure why you're insisting in using a regular expression for that? :smiley: If there is a specific reason, please elaborate.

If you want to use my suggestion inside an action, just use a "Format value" action for _FILENAME using the format strings I've mentioned above.

That did it! Never used it that way before, and having the action saved is a major help
Thank you so much!
Solved. :slight_smile:

1 Like

7 posts were split to a new topic: Remove certain string from end of filename