Regularization by dimensional reduction of supersymmetric and non-supersymmetric gauge theories