Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

205
Visualizações
How to validate only working Email in JavaScript?

How to validate only working Email in JavaScript? Actually, I want only working email excluding (@gmail.com, @outlook.com, @hotmail.com, @yahoo.com etc). I want only working emails like abc@stack.com etc.

about 4 years ago · Juan Pablo Isaza
3 Respostas
Responde à pergunta

0

This code is also working!

let text = "abc@hotmail.com";
let domain = text.substring(text.lastIndexOf("@"));
if(domain == "@gmail.com" || domain == "@yahoo.com" || domain == "@hotmail.com" || domain == "@outlook.com"){
    console.error("Wrong format")
}else{
    console.log("working email")
}

about 4 years ago · Juan Pablo Isaza Relatório

0

One way is to get the domain part from the email, and check it against the list of personal email domains:

const workingEmailValidator = email => 
    !['gmail', 'hotmail', 'yahoo', 'outlook'].includes(email.split('@')[1].split('.')[0])

console.log(workingEmailValidator('xyz@sss.com'))
about 4 years ago · Juan Pablo Isaza Relatório

0

I use my own function after checking if email is valid then you can check if it is work email or not :

const notAllowed = ["gmail.com", "email.com", "yahoo.com", "outlook.com"];
 function check(email) {
    const lastPortion = email.split("@")[1].toLowerCase();
     if (notAllowed.includes(lastPortion)) {
          console.log("Please enter work email");
          return false;
     }
     return true;
}
check("abc@paiman.com");
check("abc@gmail.com.com");
about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda