I have an array of objects, each object has property filename (string):
I would like to group these objects (on those filename property) with same naming starting from beginning to the last occurrence of $ sign.
So I would like to achieve this grupation (each group should be new array):
blue$
blue$_35
blue_paint$
blue_paint$_35
blue_paint$_55
01_red_carper_floor$
01_red_carper_floor$_and_roof
01_red$
green_car$
Some objects will have multiple while some will remain single.
I am using javascript and jquery.
I found a similar question but its not quite the same:
Find the longest common starting substring in a set of strings