This stackoverflow post has a cool way to remove the last occurrence of a character in vim :
:%s/.*\zs,/|/
This replaces the last occurrence of a comma with a pipe. Other examples can be found on the vim wikia.
Copyright (c) 2024 Michel Hollands