Replace characters between 6th period in a file name and the file extension with a single period

Advanced Renamer forum
#1 : 06/12-22 01:02
Bran
Posts: 1
I have done a fair bit of lurking here over the years to figure out questions like this and picked up a bit of regex along the way but this time I need to ask for help.

I'm taking over managment of the family media archive from my late father and I want to change the organization system a bit for the sake of my brain but I'm not sure how to do what I'm trying to this time.

I have a bunch of home movies that follow the following naming scheme: occasion.##.##.##.[FamilyMemberFirstName].[FamilyMemberLastName].(a bunch of other words I'd like to remove with periods between them such as the model of camera the video was taken in that my father used to sort his archive).[360p or 480p or 720p or 1080p or 2160p].mp4

For example one file is named: Christmas.19.12.25.Bill.Jones.PanSonic.Lumix.DMC.G-85.10.2160p.mp4

I'd like to remove the chacacters between Jones. and .2160p.mp4 but the names vary in length and final chacacter so the only way I can think to do it would be to remove all characters between the 6th period (which always coinsides with the end of the last name) and the resolution number.

I am happy to do multiple passes to cover each resolution [for example only removing the characters between the 6th period and 1080p.mp4 and then repeating the process for the other resolution numbers] but I don't know to target that character set.

Does anyone have a suggestion that might help me out? I know this is a super strange & specific request but I'm at a loss on how to implement it myself.
#2 : 06/12-22 01:35
David Lee
Posts: 1125
Remove pattern: [^.]*(\.[^.]*){5}\K.*
Use regular expressions

Explanation of regex...
[^.]* : Matches a string of any number of any characters except "."
(\.[^.]*){5} : As above but the string must start with "." and the whole match is repeated a total of 5 times
\K : Forget all the characters previously matched but keep the place in the string
.* : Finally match everything remaining - which is then removed ("." means any character)

edited: 06/12-22 01:36