DEV Community

Emerson Brôga Dev
Emerson Brôga Dev

Posted on

1 1

Validando CEP com RegEx

Validando CEP com RegEx

Você pode usar expressão regular para validar um número de CEP de forma rápida e fácil.

Uma outra forma de criar essa mesma função usando uma sintaxe mais curta:

const isValidBRZip = zip => /^[0-9]{5}-[0-9]{3}$/.test(zip);
Enter fullscreen mode Exit fullscreen mode

Espero que tenham gostado!

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
➜ Assita 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

Hands-on debugging session: instrument, monitor, and fix

Join Lazar for a hands-on session where you’ll build it, break it, debug it, and fix it. You’ll set up Sentry, track errors, use Session Replay and Tracing, and leverage some good ol’ AI to find and fix issues fast.

RSVP here →

Top comments (0)

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

👋 Kindness is contagious

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

Okay