Tricky to try and explain

If you need help on how to use the program
Post Reply
Smokes
Posts: 4
Joined: 2019-05-26 06:37:09

Tricky to try and explain

Post by Smokes »

Hi
Bit tricky trying to ask for help with something not knowing the correct terminology.

I have a number of files with a prefix number with same file extension.


I want to keep the numbers and file extension and maybe add something more meaningful between numbers and extension.

Example
1234567 Name of file variable in length with file extension.
and
123456 only with file extension.

What would work for these?

Thanks
Smokes
antp
Site Admin
Posts: 9651
Joined: 2002-05-30 10:13:07
Location: Brussels
Contact:

Re: Tricky to try and explain

Post by antp »

Hi,
Using regular expressions it is quite easy.
Use the following expression:
(\d+).*\.([^\.]+)
and the following new name template:
$1.$2
To keep only the number prefix and the extension
if you want to put additional text in the new name, you can put it after the $1

$1 and $2 matche the blocks between parenthesis
\d = number
+ = 1 or more
* = 0 or more
. = any character
\. = an actual dot character
[^\.] = anything except a dot
Post Reply