Regex-Rename with backreferences

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
rclkrtrzckr
Posts: 65
Joined: 03 Jan 2017 13:10
Location: Zurich, Switzerland

Regex-Rename with backreferences

Post by rclkrtrzckr »

Hi all

I have a bunch of files with a similar filename:

19-05-01_onetwothree.pdf
19-06-02_anotherone.pdf

The first 6 characters are the date these files were created (I get them from my insurance that way). Now I'd like to rename them to match my file naming conventions (YYYYMMDD_....). On a unix system, I would probably do something like this (untested):

Code: Select all

s/^([0-9]{2})-([0-9]{2})-([0-9]{2})_/20\1\2\3_/
Is there a way to do this in XYplorer? In the help, there's only one example, where the regex is used to match the files to be renamed.

Thanks in advance

André

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

Re: Regex-Rename with backreferences

Post by highend »

As long as you only have those files (that need to be renamed) selected,
right click them, "Rename Special" - "RegExp Rename..."

^(.) > 20$1
One of my scripts helped you out? Please donate via Paypal

rclkrtrzckr
Posts: 65
Joined: 03 Jan 2017 13:10
Location: Zurich, Switzerland

Re: Regex-Rename with backreferences

Post by rclkrtrzckr »

highend wrote: 05 Aug 2019 10:23 As long as you only have those files (that need to be renamed) selected,
right click them, "Rename Special" - "RegExp Rename..."

^(.) > 20$1
Awesome, thanks!

Post Reply