Page 1 of 1
Batch Rename RegEx End of Name
Posted: 23 Sep 2008, 18:30
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.
Posted: 23 Sep 2008, 19:10
by cincura.net
The '$' sign is end of RE. Not end of file name. That means, that i.e.
means three characters at the end.
Re: Batch Rename RegEx End of Name
Posted: 23 Sep 2008, 21:52
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$
Batch Rename RegEx End of Name
Posted: 24 Sep 2008, 09:02
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
Re: Batch Rename RegEx End of Name
Posted: 24 Sep 2008, 13:15
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
Posted: 24 Sep 2008, 16:54
by Ether
The $ sign doesn't work by itself in the regex library from Henry Spencer, which is integrated in Salamander.
Posted: 29 Sep 2008, 13:41
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".
Posted: 29 Sep 2008, 15:10
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.
Posted: 29 Sep 2008, 15:30
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).
Posted: 30 Sep 2008, 07:55
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 