Page 1 of 1

Multi-Rename with Regular Expressions in FreeCommander

Posted: 11.01.2019, 19:39
by bigstarblue
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.

Re: Multi-Rename with Regular Expressions in FreeCommander

Posted: 15.01.2019, 22:17
by Marek
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.

Re: Multi-Rename with Regular Expressions in FreeCommander

Posted: 20.01.2019, 22:59
by Florent
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.

Re: Multi-Rename with Regular Expressions in FreeCommander

Posted: 06.02.2019, 23:04
by NetMage
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

Re: Multi-Rename with Regular Expressions in FreeCommander

Posted: 11.02.2019, 13:32
by Florent
Thank you very much NetMage.
I will get a look at it to further understand how it works.