Remove Characters in Filename

A swapping-ground for Regular Expression syntax

Remove Characters in Filename

Postby Wayne_Wickson » Tue Jan 02, 2024 12:42 am

In many of the filenames I have to change, there is a three-digit page number just before the ".jpg". The examples below show this. How would I remove just the page numbers leaving the rest of the filename intact, including the .jpg extension?

2004_09_22 LAKE GARNEAU Janice_Tracy 2004_09_27 389.jpg [389 to be removed]
2004_09_26 ALLIN Earl_Howard 2004_09_27 219.jpg [219 to be removed]

Thanks.

Wayne
Wayne_Wickson
 
Posts: 4
Joined: Tue Jan 02, 2024 12:16 am

" 3-digits.jpg" ---> ".jpg"

Postby Luuk » Wed Jan 03, 2024 12:37 am

With a checkmark for "Inc.Ext." the "Match" and "Replace" can be like...
(.+) \d{3}\.(?i)jpg$
\1

If needing something more exact, can change the "Match" to...
(.+ 20\d\d_\d\d_\d\d) \d{3}\.(?i)jpg$
Luuk
 
Posts: 771
Joined: Fri Feb 21, 2020 10:58 pm

Re: Remove Characters in Filename

Postby Wayne_Wickson » Wed Jan 03, 2024 1:26 am

Thanks, Luuk. The first example works like a charm! Is there a good tutorial showing how to use the many combinations of this excellent software?

Wayne
Wayne_Wickson
 
Posts: 4
Joined: Tue Jan 02, 2024 12:16 am


Return to Regular Expressions