Topic: Extract only the end of a string
Extract only the end of a string
From:
A0B1C2DE_0201.jpg
A1B#0302.gif
To:
0201.jpg
0302.gif
Use the expression:
%f(-8)
How does it work ?
The "()" modifier permits the extraction of a part of the string it is associated to.
Its first parameter is the starting position of this extraction,
an optional second parameter specifies the number of characters to extract. [e.g. %f(1,4)]
If it's not given, the extraction is done until the end.
Which value to choose as starting position ?
It depends on the file we examine.
10 would be the starting position for the first
1234567890
A0B1C2DE_0201.jpg
and 5 would be the starting position for the second ...
12345
A1B#0302.gif
In fact, we only need the last 8 characters.
If Siren could provide us such an feature that would help us a lot!
It would be interesting to specify
that the number of the first character to extract
is relative to the end and not the beginning of the string.
Siren manages this with "negative" numbers.
For example, with "ABCDEF":
%b(2,1) gives "B" : positive start, so relative to the beginning
%b(-2,1) gives "E" : negative start, so relative to the end
More clearly, -8 "alone" will specify: "the 8 last characters"
Let's test this:
%f is the full file name
So, following the expression for "A1B#0302.gif":
%f gives "A1B#0302.gif"
%f(-8) gives "0302.gif"
And for A0B1C2DE_0201.jpg
%f gives "A0B1C2DE_0201.jpg"
%f(-8) gives "0201.jpg"
--
For more details just download Siren at http://www.scarabee-software.net/en/siren.html and consult the help.
No installation needed, unzip and run. Siren stores it settings into an ini file. <Here> you can see some screen shots of Siren.
Enjoy Siren, the powerfully portable freeware renamer.