Remove number of characters starting with certain prefix

A swapping-ground for Regular Expression syntax

Remove number of characters starting with certain prefix

Postby bmc38119 » Fri Aug 27, 2021 7:16 pm

I need to rename a number of files to the following (example of a single file below below):
0L045301A_FAW013581191-25702653_1.jpg
0L045301A_FAW013581191_1.jpg

I would like to run this on a number of files by looking for the following prefix "-2570" and removing that string plus the 4 characters following that.

How would I go about building a regex expression to accomplish this?
bmc38119
 
Posts: 2
Joined: Fri Aug 27, 2021 6:53 pm

Re: Remove number of characters starting with certain prefix

Postby therube » Fri Aug 27, 2021 7:35 pm

12:Filters, Mask: *-2750*

1:RegEx
Code: Select all
Match:  (.*)-2570....(.*)
Replace:  \1\2
therube
 
Posts: 1314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Remove number of characters starting with certain prefix

Postby bmc38119 » Fri Aug 27, 2021 9:22 pm

Worked perfectly. Thank you!
bmc38119
 
Posts: 2
Joined: Fri Aug 27, 2021 6:53 pm


Return to Regular Expressions