bug in the move command

Advanced Renamer forum
#1 : 13/07-22 16:13
Matan
Matan
Posts: 7
in hebrew i've tried to add a move method that would take the last character of the name if it's a digit and move it to the beginning of the line using regular expressions.
but it doesn't do that, infact it does it to the character before the last character of the name, thinking it's the last one.
so this is a bug.
the method is:
from: \d
count: 1
to: ^


13/07-22 16:13
#2 : 13/07-22 19:07
David Lee
David Lee
Posts: 981
It's not a bug. If you use a regular expression to select the "Move from" point the selection starts at the character following the regex match (it is logical since the match can comprise multiple characters).

Use a Replace method instead...

Replace: ^(\d)(.*)
with: \2\1
Use regular expressions



13/07-22 19:07
#3 : 13/07-22 21:20
Matan
Matan
Posts: 7
Reply to #2:
no, it doesn't find the last character at all.


13/07-22 21:20
#4 : 13/07-22 23:15
David Lee
David Lee
Posts: 981
Reply to #3:

Since you are working with Hebrew file names you must clearly define what you mean by the first and last characters of the filename (ie are you counting right to left or left to right?).

Try...
Replace: (.*)(\d)$
with: \2\1


13/07-22 23:15
#5 : 14/07-22 05:44
Matan
Matan
Posts: 7
Reply to #4:
that works, though it doesn't find multiple numbbers at the end of the name.


14/07-22 05:44 - edited 14/07-22 05:46
#6 : 14/07-22 10:36
David Lee
David Lee
Posts: 981
Reply to #5:
Of course it doesn't! You specified the LAST character and your original regex - \d - would only match a single digit.

Try: ([^\d]*)(\d+)$


14/07-22 10:36
#7 : 15/07-22 00:58
Matan
Matan
Posts: 7
Reply to #6:
i liked the logic of it, works, very interesting.
thank you for your answer.


15/07-22 00:58