Rename Files with RegEx

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
armsys
Posts: 557
Joined: 10 Mar 2012 12:40
Location: Hong Kong

Rename Files with RegEx

Post by armsys »

Code: Select all

D:\Views in sql server Part 39.pdf
D:\View limitations in sql server Part 42.pdf
D:\Updatable views in sql server Part 40.pdf
D:\Updatable common table expressions in sql server Part 50.pdf
D:\Unique key constraint - Part 9.pdf
D:\Unique and Non Unique Indexes in sql server Part 37.pdf
D:\Transactions in sql server Part 57.pdf
D:\IsDate, Day, Month, Year and DateName DateTime functions in SQL Server Part 26.pdf
D:\Instead of insert trigger Part 45.pdf
D:\Inline table valued functions in sql server Part 31.pdf
How to rename the above files with RegEx?
Goal: Replace "(title) Part ##.pdf" to "(Chapter ##) (title).pdf"
For example, the first filename above should become: D:\Chapter 39 Views in sql server.pdf
My RegEx (^\w*) Part (\d{1,2}) > Chapter $2 $1 fails.

highend
Posts: 14948
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Rename Files with RegEx

Post by highend »

If you really use the "Rename Special - RegExp Rename..."

Code: Select all

(^.*?)(\sPart\s)(\d{1,2}) > Chapter $3 $1
One of my scripts helped you out? Please donate via Paypal

armsys
Posts: 557
Joined: 10 Mar 2012 12:40
Location: Hong Kong

Re: Rename Files with RegEx

Post by armsys »

Code: Select all

(^.*?)(\sPart\s)(\d{1,2}) > Chapter $3 $1
Your solution works like a charm. Thanks a lot.

Post Reply