Delete all digits at END of filename only

Bulk Rename Utility How-To's

Delete all digits at END of filename only

Postby w945106 » Mon Aug 29, 2022 9:19 pm

I need to delete all non-alphabetic characters at the end of a file name (after a string of words) without deleting digits at the beginning of the filename.

20040315_093300_13_SkiTrip_Steamboat_200403_016.jpg => 20040315_093300_13_SkiTrip_Steamboat.jpg
20040606_210400_1433_LegoLand_SanDiego_200406_0016.tif => 20040606_210400_1433_LegoLand_SanDiego.tif

I want to delete everything after the last alphabetical character in the filename, leaving the .extension intact.

Thank you.
w945106
 
Posts: 2
Joined: Mon Aug 29, 2022 9:07 pm

Delete characters at end of filename

Postby Luuk » Tue Aug 30, 2022 12:26 am

To delete everything after the last english letter, RegEx(1) can use a "Match" and "Replace" like...
(.*[A-Za-z]).*
\1

To delete everything after any last letter including unicodes, put a checkmark for "v2", so then more like...
^(.*(?![\d_])\w).*
$1

To delete underscores and digits from the end, "v2" uses a Match like...
[\d_]+$

To delete all strings of "_digits" from the end, "v2" uses a Match like...
(\d_+)+$
Luuk
 
Posts: 706
Joined: Fri Feb 21, 2020 10:58 pm

Re: Delete all digits at END of filename only

Postby w945106 » Tue Aug 30, 2022 4:07 pm

That worked perfectly.

Thank you!
w945106
 
Posts: 2
Joined: Mon Aug 29, 2022 9:07 pm

Delete characters at end of filename

Postby Luuk » Tue Aug 30, 2022 4:47 pm

Except I made a typo on the last example! My keyboard is dying, so Im conducting way too many copy/pasting.
To delete all strings of "_digits" from the end, "v2" should use a Match like...
(_\d+)+$
Luuk
 
Posts: 706
Joined: Fri Feb 21, 2020 10:58 pm


Return to How-To