Ignore the part of filename

Advanced Renamer forum
#1 : 18/03-20 14:32
Posts: 2
Hi guys,

I need to rename about 300 files and i've a little problem with it

Every file name end with a version part f.e., ver1.0, ver0.1 etc.

In the middle part of the name there are extra "." character which i have to remove, but in the version part I have to keep them.






Many thanks

18/03-20 14:32
#2 : 18/03-20 15:54
David Lee
David Lee
Posts: 365
You can do this in three steps, using a List replace method:

1. Find and replace the final dot with a temporary character not permitted in a Windows filename (eg ":").
2. Replace all remaining dots with nothing
3. Replace the temporary character with a dot.

You will need to "Use regular expressions".

Add 3 lines to the List replace method...

1. replace "\.(?=\d*$)" with ":"
2. replace "\." with <blank>
3. replace ":" with "."


In a regular expression "." has a special meaning (match any character) so we have to use "\." to force it to represent itself ("\" is the "escape" character).

"\.(?=\d*$)": matches a dot only if it is followed by any number (including zero) of digits at the end of the filename.

"(?=xyz)" is a "lookahead" which means that the preceding character has to be followed by "xyz"in order to be matched, but "xyz" is not included in the match.

"$" represents "end of line"

18/03-20 15:54 - edited 18/03-20 16:40
#3 : 18/03-20 16:52
David Lee
David Lee
Posts: 365
Reply to #2:

You can do it in a single step:

Replace method
Occurence: All
Replace "\.(?!\d*$)" with <blank>
Use regular expressions.

Similar to my previous solution but "(?!xyz)" is a NEGATIVE lookahead
ie the preceding character is only matched if it is NOT followed by "xyz".

18/03-20 16:52 - edited 18/03-20 16:55
#4 : 18/03-20 17:41
Posts: 2
Reply to #3:

It works fine, thank you so much!!

18/03-20 17:41