texto=nombreFormulario.nombreControl.value; patron=/^\d{3}\s\d{7}$/g; if(!patron.test(obj.value)) alert('Nº incorrecto')