DEV Community

Emerson Brôga Dev
Emerson Brôga Dev

Posted on

3 2

Validando email com RegEx

Validando email com RegEx

Com a quantidade de top-level domains hoje em dia, fica difícil validar emails.
Usando RegEx (Regular Expressions ou Expressões regulares) a única coisa que a gente pode verificar é se o email contém o @ e algum texto antes e depois do @. No mais seria mandar o email de confirmação para validade de verdade.

Outra forma mais curta de escrever essa função seria:

const isEmail = text => /^.+@.+$/.test(text);
Enter fullscreen mode Exit fullscreen mode

Não deixe de visitar o repositório do github com todas as dicas em emersonbrogadev/social-media-snippets.

➜ Participe da nossa lista de desenvolvedores
➜ Aprenda ES6
➜ Veja as dicas no Instagram
➜ Assista nosso canal no YouTube
➜ Curta nossa página no Facebook
➜ Não perca as atualizações no Twitter
➜ Veja os repositórios no Github

=)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

Top comments (0)

SurveyJS custom survey software

JavaScript Form Builder UI Component

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay