#1 2023-05-06 11:44

Rascom
Member
Registered: 2023-05-06
Posts: 1

How to rename a file with text that is inside brackets ?

Hello. How to rename a file with text that is inside brackets ?

Example:
"File_Name [ABC-123].txt"
or
"File_Name (ABC-123).txt" needs to become:

"ABC-123.txt"

Brackets can be anywhere in file name.

Offline

#2 2023-05-06 22:56

den4b
Administrator
From: den4b.com
Registered: 2006-04-06
Posts: 3,440

Re: How to rename a file with text that is inside brackets ?

It can be done in few different ways.

For example, using these Regular Expression rules:

1) Replace expression ".*?\((.*?)\).*" with "$1" (skip extension)
2) Replace expression ".*?\[(.*?)\].*" with "$1" (skip extension)

Example input filenames:

File_Name [ABC-123].txt
File_Name (ABC-456).txt

Example output filenames:

ABC-123.txt
ABC-456.txt

Offline

Board footer

Powered by FluxBB