Simple Rename

A swapping-ground for Regular Expression syntax

Simple Rename

Postby wryterjccc » Sun Feb 04, 2024 7:34 pm

I am just learning RegEx, but I have a very simple (I think) problem for now.

The filename is:
The Lone Ranger 440807 Al Jennings.wav
I want to change it to:
Lone Ranger The 440807 Al Jennings.wav

Basically, I want to reorder the words. The Simple option is turned on. If I use the Find and Replace options:
%1 %2 %3
%2 %3 %1

The result is:
Lone Ranger 440807 Al The.wav
So it has cut the word "Jennings" out and put "The" at the end.
If, in the Search and Replace boxes, I type:
%1 %2 %3 %4
%2 %3 %1 %4

Everything works fine. Could you please tell me why this is happening and if, in the future, do I always need to add the extra word following the words I want to manipulate? I have been looking for documentation for the Simple function, but have yet to find any way of answering my question. Any suggestions? Thanks.
John
wryterjccc
 
Posts: 4
Joined: Mon May 03, 2021 4:47 pm

Simple %group-numbers

Postby Luuk » Mon Feb 05, 2024 12:13 am

With Simple having the same %group-numbers inside the "Match" and "Replace", nothing can be removed.
An ending %group-number inside of the "Match", will always match until the very end of your filename.
Luuk
 
Posts: 705
Joined: Fri Feb 21, 2020 10:58 pm

Simple %group-numbers

Postby Luuk » Mon Feb 05, 2024 12:46 am

The only thing Im guessing. is that maybe your "Match" was like "%1 %2 %3 " but this forum software deleted your trailing space??
So if your "Match" doesnt start/terminate with %group-numbers, then Simple can remove outer text that's not getting matched.
So terminating with a space means that everything after that space cant be matched, and gets deleted!
Luuk
 
Posts: 705
Joined: Fri Feb 21, 2020 10:58 pm

Re: Simple Rename

Postby wryterjccc » Fri Feb 09, 2024 11:06 pm

Putting the space in at the end was exactly my problem. Thanks for the explanation.
John
wryterjccc
 
Posts: 4
Joined: Mon May 03, 2021 4:47 pm


Return to Regular Expressions