You are not logged in.
Pages: 1
hello,
i have a problem with RegEx.
i have a huge list of files, and some of them end with 4 numbers.
I think that's easy to do, but i can't find how i can remove the last 4 caracters only if they are 4 numbers...
If someone has an idea
Thanks ^^
Offline
You are missing a couple of examples of input and desired output filenames.
The exact rule might differ depending on the specifics of your input filenames, but here is a good start for you:
Regular Expressions rule - Replace expression "\d{4}\Z" with "" (skip extension)
For the reference:
https://www.den4b.com/wiki/ReNamer:Regular_Expressions
Offline
hello,
i have a problem with RegEx.
i can't find how i can remove the last 4 caracters only if they are 4 numbers...
Hi and welcome,
>>> i have a huge list of files, and some of them end with 4 numbers.
Else you could just use the Delete rule (https://www.den4b.com/wiki/ReNamer:Rules:Delete) with "Right-to-left" (from the end) option.
see http://www.den4b.com/wiki/ReNamer:Regular_Expressions
\d ==> a numeric character
\Z ==> end of text ($ is an alternative)
{n} ==> exactly n times
FROM:
Test.txt
Test 1.txt
Test 12.txt
Test 123.txt
Test 1234.txt
Test 1234 Kopie.txt
TO:
Test.txt
Test .txt
Test 1.txt
Test 12.txt
Test 123.txt
Test 1234 Kopie.txt
USE RegEx:
http://www.den4b.com/wiki/ReNamer:Rules:RegEx
Expression: "\d{4}$"
Replace: "" (skip extension)
Explanation:
"\d{4}$" means four times \d ==> \d\d\d\d , matched at the very end ==> $
Adjust the Expression to your need.
For example also match and remove the empty space in front of the four digits >>> Expression: " \d{4}$"
Additionally enable "Options > Fix conflicting new names"
http://www.den4b.com/wiki/ReNamer:Options_menu
Fine?
Read the *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)
Offline
wow, thank you ! that works... the regex seems so easy once you see it
Offline
Pages: 1