Delete all letters after a serie of numbers

Advanced Renamer forum
#1 : 12/05-20 23:22
Claudio
Claudio
Posts: 1
Hello
I'm realy a newbie
I have files as these
2791193991AbcDfghLmklj
279119399122AbcDfghLmrts
How can I delete all the letter to obtain this?
2791193991
279119399122

Thanks


12/05-20 23:22
#2 : 15/05-20 10:54
David Lee
David Lee
Posts: 1125
You should read the User Guide to get started:
www.advancedrenamer.com/user_guide/gettingstarted

In this case you can use the Remove pattern method with a Regular Expression:

Pattern: \d*\K.*
Use regular expressions
Apply to: Name

Regular expressions are powerful tools that use "metacharacters" to select parts of a string. They look a bit daunting at first but are really quite straightforward when you get to grips with the concept. There is a basic introduction in the User Guide at:
https://www.advancedrenamer.com/user_guide/regul ar_expresions
and further help is easily found on-line using a Google search.

In this case:

\d* will match any string of numerical digits and .* will match a string of any characters.
So \d*.* would match and remove the entire filename

The metacharacter \K is an instruction to forget the characters matched up to that point - so the expression \d*\K.* means that the leading digits will not be part of the final match and so will not be deleted.

Note that \K is not included in the basic introduction in the User Guide.




15/05-20 10:54 - edited 15/05-20 11:09
#3 : 15/05-20 11:08
David Lee
David Lee
Posts: 1125
Reply to #2:

There are often several ways of achieving the same effect.
Another simple solution is:

Remove method...
Remove count: $
Starting at \d*
Use regular expressions

Usually the Remove method uses numbers to define where to start removing characters and how many to remove. However regular expressions define the starting and ending positions.

Here the starting point follows the string of digits matched by \d* and the metacharacter $ indicates the end of the filename.


15/05-20 11:08