Multi-Rename with Regular Expressions in FreeCommander

Discussion, questions and support.
Post Reply
Message
Author
bigstarblue
Posts: 2
Joined: 05.01.2019, 23:00

Multi-Rename with Regular Expressions in FreeCommander

#1 Post by bigstarblue » 11.01.2019, 18:39

Hi.

Objective: Multi-Rename with Regular Expressions in FreeCommander

Used version: FreeCommander XE 2019 Build 790a 32-bit public


I present my case:

I am working with Regular Expressions to rename a large volume of files using the
Multi-Rename feature.

I have these files as an example:

1 - Getting Started.mp4
2 - Writing Your First.mp4
12 - With Statements.mp4
13 - If Statements.mp4

The final result I would like to obtain using Regular Expressions in Multi-Rename would be the following:

001 - Getting Started.mp4
002 - Writing Your First.mp4
012 - With Statements.mp4
013 - If Statements.mp4

Rules to keep in mind:
1) Solve the problem only with Regular Expressions
2) All files must be renamed with three (3) digits
3) Do not use the Counter Tool to number -> File Name: [c] - [n, 5] ... etc

MY SOLUTION OF MOMENT
----------------------------------
It is carried out in two (2) steps and is as follows:

First step:
--------------
Search for: (^\d\s)(.*)
Replace with: 00$1$2
Yes: Regular Expression
Yes: Exclude extension
Yes: Replace in all cases

This makes the files:

1 - Getting Started.mp4
2 - Writing Your First.mp4

Be renamed by this:

001 - Getting Started.mp4
002 - Writing Your First.mp4

Second step:
-----------------
Search for: (^\d\d\s)(.*)
Replace with: 0$1$2
Yes: Regular Expression
Yes: Exclude extension
Yes: Replace in all cases

This makes the files:

12 - With Statements.mp4
13 - If Statements.mp4

Be renamed by this:

012 - With Statements.mp4
013 - If Statements.mp4

As you can see it takes two (2) steps to rename both groups of files as required
using the Regular Expressions of FreeCommander in Multi-Rename.

However, a text editor such as Notepad++ allows me to handle the Regular Expressions of a
very efficient way.

So for example I can enter the following Regular Expression in Notepad++

Search: (^\d\s.*)|(^\d\d\s.*)
Replace with: (?{1}00\1:0\2)
Yes: Regular Expression

To convert this:

1 - Getting Started.mp4
2 - Writing Your First.mp4
12 - With Statements.mp4
13 - If Statements.mp4

In this other:

001 - Getting Started.mp4
002 - Writing Your First.mp4
012 - With Statements.mp4
013 - If Statements.mp4

The most important thing is that Notepad++ is able to execute this in a single action.

And in this WEB you can see working the Regular Expression:
https://regex101.com/r/5NX7u0/1


THIS ARE MY QUESTIONS:
-----------------------------------

1) Which Regular Expressions engine does FreeCommander use?

2) a) Premise:
Certainly FreeCommander can do searches with Regular Expressions
conditional

b) Question:
Can FreeCommander make conditional replacements using the Regular Expressions
How does Notepad++?


EARLY CONCLUSION
--------------------------
Because of the multiple tests that I have done, I am thinking that FreeCommander is not capable of doing
conditional replacements using Regular Expressions. If so, I would have to continue doing it
in two (2) or more steps as I currently do.

If on the contrary, FreeCommander is enabled for it, what is the correct way to
Write the Regular Expression for a conditional replacement?


I appreciate your responses and your interest in reading my message.

I apologize for my little English since I speak Spanish.

Marek
Author
Author
Posts: 2495
Joined: 10.04.2006, 07:48
Location: Germany
Contact:

Re: Multi-Rename with Regular Expressions in FreeCommander

#2 Post by Marek » 15.01.2019, 21:17

1) Which Regular Expressions engine does FreeCommander use?
DIRegEx
Can FreeCommander make conditional replacements using the Regular Expressions
No, it is not supported by DIRegEx

Your approach is correct. You have to do this in several steps.

Florent
Posts: 17
Joined: 27.11.2018, 21:43

Re: Multi-Rename with Regular Expressions in FreeCommander

#3 Post by Florent » 20.01.2019, 21:59

Interesting topic.
But I did not find a solution to your problem either.

The link provided by Marek gives some information on the synthax.
Where can I find the full documentation (for free)?
I am kind of lost among all the regex flavor documentations available, I would like to know better the one used by FC since it is (almost) the only program where I use regex.

NetMage
Posts: 1
Joined: 06.02.2019, 19:30

Re: Multi-Rename with Regular Expressions in FreeCommander

#4 Post by NetMage » 06.02.2019, 22:04

You can download the demo of DIRegEx and extract the CHM Help File, but it just contains a copy of the PCRE Syntax and Pattern pages, which you can also find here:
https://www.pcre.org/original/doc/html/pcresyntax.html
https://www.pcre.org/original/doc/html/pcrepattern.html

Florent
Posts: 17
Joined: 27.11.2018, 21:43

Re: Multi-Rename with Regular Expressions in FreeCommander

#5 Post by Florent » 11.02.2019, 12:32

Thank you very much NetMage.
I will get a look at it to further understand how it works.

Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests