fixing clearIfNotMatch feature in cases of optional and recursive digits