Do it with a lerp node.
red -> connect your whole string from the first material with A and the string from the 2nd material with B
green -> Here you can add a mask, constant vector (0 = it just shows the first material, 1 = it just shows the 2nd material, 0.5/0.2/0.8/… = mix between both,…)