How do you join objects autmatically with the same suffix?

OK, I have a trillion objects in my scene (nah, just kidding! But close to a hundred, though…) and I want to find a way of automating things so that I can merge/join objects that have the same suffix EG ball_03 and bat_03, ball_04 and bat_04, etc…

I know that I can use the suffix in the filter in the outliner to speed things up but it is still time consuming.

Without coding, is there an addon or technique that I can use to join multiple objects into one just by matching their suffixes or prefixes?

I know it’s a long shot but I thought I would ask nonetheless.

Thank in advance.