how to re assign materials in a scene ?

let say you have a scene with many objects and each object having several materials

now the problem is that there are too many mat in this scene!

so is there a way to re assing material to reduce the quantity of materials?

let say based may be on the RGB values

if there are let say 12 different black color material and want to reduce it down to 1 black material

like you want to have only one color Black for all RGB < 0.2

thanks for any feedback