Fixed validation script to not run regex checks if a field is not required.