#1 2019-05-14 09:31

BadDogTitan
Member
Registered: 2018-12-08
Posts: 8

Remove Numbers in Brackets

I have thousands of files in the following format:

Filename 1 (A101 8.2 S3)
Filename 2 (A5 9 R14B)
Filename 3 (A45 27 M24)

How would I rename them to:

Filename 1 (S3)
Filename 2 (R14B)
Filename 3 (M24)

I know RegEx is the answer, just can't figure it out.

Thanks.

Offline

#2 2019-05-14 13:03

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 2,758

Re: Remove Numbers in Brackets

The following regular expression should do the job...

Expression: \(.*?\b([\w\d]+)\)
Replace: ($1)

Sample input:

Filename 1 (A101 8.2 S3)
Filename 2 (A5 9 R14B)
Filename 3 (A45 27 M24)
Filename 5 (TEST)

Output:

Filename 1 (S3)
Filename 2 (R14B)
Filename 3 (M24)
Filename 5 (TEST)

Offline

#3 2019-05-24 13:28

BadDogTitan
Member
Registered: 2018-12-08
Posts: 8

Re: Remove Numbers in Brackets

Fantastic den4b! On using it, I realize the output would look better without the brackets.

How would I return just the number?

Last edited by BadDogTitan (2019-05-24 13:30)

Offline

#4 2019-05-24 13:59

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 929

Re: Remove Numbers in Brackets

BadDogTitan wrote:

Fantastic den4b! On using it, I realize the output would look better without the brackets.

How would I return just the number?


Try to adjust the "Replace:" statement.

Just play around, it's easy:)




 


For more help and how-to's  read our fine Wiki.
If ReNamer had helped you, please donate a coin to Denis or buy a Pro license for commercial use. (Lite vs Pro)

Offline

#5 2019-05-28 19:35

Stefan
Moderator
From: Germany, EU
Registered: 2007-10-23
Posts: 929

Re: Remove Numbers in Brackets

Stefan wrote:
BadDogTitan wrote:

Fantastic den4b! On using it, I realize the output would look better without the brackets.

How would I return just the number?


Try to adjust the "Replace:" statement.

Just play around, it's easy:)

 



And, BadDogTitan, how did it worked out?




 


For more help and how-to's  read our fine Wiki.
If ReNamer had helped you, please donate a coin to Denis or buy a Pro license for commercial use. (Lite vs Pro)

Offline

#6 2019-06-09 20:05

BadDogTitan
Member
Registered: 2018-12-08
Posts: 8

Re: Remove Numbers in Brackets

Sorry, Stefan. Haven't been back for a while. Worked out famously. Also, I found the Regular Expression tool on the website, which is a great help.

Offline

Board footer

Powered by FluxBB