Batch Rename RegEx End of Name

Discussion of bugs and problems found in Altap Salamander. In your reports, please be as descriptive as possible, and report one incident per report. Do not post crash reports here, send us the generated bug report by email instead, please.
lou
Posts: 2
Joined: 23 Sep 2008, 18:24

Batch Rename RegEx End of Name

Post by lou »

Hi,
I am trying to use Batch Rename with Regular Expressions and want to match the end of a name but it seems that this does not work in Salamander 2.51.
Attachments
Sal251_BatchRenameBug.gif
Sal251_BatchRenameBug.gif (9.85 KiB) Viewed 11930 times
cincura.net
Posts: 593
Joined: 09 Dec 2005, 17:30
Location: a step further
Contact:

Post by cincura.net »

The '$' sign is end of RE. Not end of file name. That means, that i.e.

Code: Select all

...$
means three characters at the end.
Jiri {x2} Cincura
User avatar
ino
Posts: 440
Joined: 09 Dec 2005, 14:59
Location: Brno, Czech Republic

Re: Batch Rename RegEx End of Name

Post by ino »

Hi, as Jiri wrote the dolar sign means end of line. It specify the position - in your example you are missing what you want to search for, you have only specified the "at the end".
Usage example:
Lets say you have filename jpg_jpg_01.jpg and you wan to rename the last occurance of "jpg". In this case you must search for expresion: jpg$
Attachments
Clipbrd1.png
Clipbrd1.png (9.45 KiB) Viewed 11915 times
lou
Posts: 2
Joined: 23 Sep 2008, 18:24

Batch Rename RegEx End of Name

Post by lou »

Hi,
thanks for your feedback.
I just wanted to append something at the end of each filename.
From what you wrote the solution for this would be to capture the last character in a group:
(.)$
and consider this in the replacement expression:
$(0)test
User avatar
ino
Posts: 440
Joined: 09 Dec 2005, 14:59
Location: Brno, Czech Republic

Re: Batch Rename RegEx End of Name

Post by ino »

lou wrote:I just wanted to append something at the end of each filename.
To add something at the end of the filename use edit box New name with parameter $(OriginalName)something
User avatar
Ether
Posts: 1471
Joined: 10 May 2007, 16:08
Location: Czech Republic
Contact:

Post by Ether »

The $ sign doesn't work by itself in the regex library from Henry Spencer, which is integrated in Salamander.
Ελληνικά rulez.
Petr Solin
ALTAP Staff
ALTAP Staff
Posts: 1112
Joined: 08 Dec 2005, 09:13
Location: Novy Bor, Czech Republic
Contact:

Post by Petr Solin »

ether wrote:The $ sign doesn't work by itself in the regex library from Henry Spencer, which is integrated in Salamander.
It works (Renamer uses extended version of this library). Try to rename file "todo.txt", Search for: "t$", Replace with: "X", turn off Only once in each name, turn on Regular expression. Result is "todo.txX". If you use only "t" in Search for, the result will be "Xodo.XxX".
User avatar
ino
Posts: 440
Joined: 09 Dec 2005, 14:59
Location: Brno, Czech Republic

Post by ino »

Petr Solin wrote: It works (Renamer uses extended version of this library). Try to rename file "todo.txt", Search for: "t$", Replace with: "X", turn off Only once in each name, turn on Regular expression. Result is "todo.txX". If you use only "t" in Search for, the result will be "Xodo.XxX".
So the Regular expression solution for lou is to search for (t$) including brackets and replace it with $1something and turn off Only once in each name, turn on Regular expression to append something at the end of each filename as descibed Petr Solin.
Petr Solin
ALTAP Staff
ALTAP Staff
Posts: 1112
Joined: 08 Dec 2005, 09:13
Location: Novy Bor, Czech Republic
Contact:

Post by Petr Solin »

ino wrote:So the Regular expression solution for lou is to search for (t$) including brackets and replace it with $1something and turn off Only once in each name, turn on Regular expression to append something at the end of each filename as descibed Petr Solin.
I think the solution using $(OriginalName)something is much easier, but if you want to use regular expression, search rather for (.)$, it's always working (not only for names ending with t).
User avatar
ino
Posts: 440
Joined: 09 Dec 2005, 14:59
Location: Brno, Czech Republic

Post by ino »

Petr Solin wrote: I think the solution using $(OriginalName)something is much easier, but if you want to use regular expression, search rather for (.)$, it's always working (not only for names ending with t).
Of course dot matches (almost) any character not t :oops:
Post Reply