Multiple values in replace string

A swapping-ground for Regular Expression syntax

Multiple values in replace string

Postby nige999 » Thu Jun 23, 2016 8:25 am

Hi all

I need to rename a load of files that have a year in them which needs to be removed.

I am doing this one year at a time which is tedious to say the least.

Is there a way to put in something like 2010, 2011, 2012, 2013, 2014, 2015, 2016 to do the lot in one go.

I don't want to nemove any other numbers in the file name and also need to get rid of certain character strings in the file name at one go, like ABC, EFG, XYZ or whatever.

Thanks !
nige999
 
Posts: 2
Joined: Thu Jun 23, 2016 8:17 am

Re: Multiple values in replace string

Postby therube » Thu Jun 23, 2016 12:25 pm

A start ...

1.RegEx

Code: Select all
Match:  (.*)( \d{4})(.*)
Replace:  \1\3


That just says to look for 4 consecutive digits, so that could be 1960 or 2016 or 0000.
Depending on your needs, your could tighten that up, maybe something like:

Code: Select all
Match:  (.*)( 20\d{2})(.*)


That would only find from 2000 to 2099.

Your second half, the character string removal, not really enough to go on with that.

3.Replace could be used for 1 particular string removal, but not multiple at once.
Last edited by therube on Thu Jun 23, 2016 5:40 pm, edited 1 time in total.
therube
 
Posts: 314
Joined: Mon Jan 18, 2016 6:23 pm

Re: Multiple values in replace string

Postby nige999 » Thu Jun 23, 2016 1:05 pm

Hi

Thanks for the prompt reply.

Neither option works.

BTW - my version of Bulk Rename Utility is 3.0.0.1
nige999
 
Posts: 2
Joined: Thu Jun 23, 2016 8:17 am

Re: Multiple values in replace string

Postby therube » Thu Jun 23, 2016 5:39 pm

Provide some examples of actual filenames & what you want them renamed to.
therube
 
Posts: 314
Joined: Mon Jan 18, 2016 6:23 pm


Return to Regular Expressions