Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Expressões Regulares
Search
Vitor Mendrone
January 23, 2020
Technology
0
33
Expressões Regulares
O mínimo que você precisa saber sobre expressões regulares para parecer um gênio.
Vitor Mendrone
January 23, 2020
Tweet
Share
More Decks by Vitor Mendrone
See All by Vitor Mendrone
Como se tornar indispensável em um mercado em crise?
mendrone
0
76
A arte da composição
mendrone
0
25
Como escolher uma stack para meu projeto?
mendrone
0
25
Future Proof CSS - 2019
mendrone
0
73
Vue.js - O Antes, o Durante e o Depois
mendrone
0
110
Future Proof CSS
mendrone
1
100
High Speed Workflow
mendrone
4
140
Usabilidade - O bom senso é o seu melhor amigo
mendrone
0
81
Um Simples Checkup Pode Salvar a Sua Loja Virtual
mendrone
0
60
Other Decks in Technology
See All in Technology
[PR] はじめてのデジタルアイデンティティという本を書きました
ritou
1
810
2025年 山梨の技術コミュニティを振り返る
yuukis
0
160
純粋なイミュータブルモデルを設計してからイベントソーシングと組み合わせるDeciderの実践方法の紹介 /Introducing Decider Pattern with Event Sourcing
tomohisa
1
1.2k
AIと融ける人間の冒険
pujisi
0
120
習慣とAIと環境 — 技術探求を続ける3つの鍵
azukiazusa1
2
500
GitHub Copilot CLI 現状確認会議
torumakabe
6
1.4k
AI に「学ばせ、調べさせ、作らせる」。Auth0 開発を加速させる7つの実践的アプローチ
scova0731
0
300
1万人を変え日本を変える!!多層構造型ふりかえりの大規模組織変革 / 20260108 Kazuki Mori
shift_evolve
PRO
6
1.5k
Contract One Engineering Unit 紹介資料
sansan33
PRO
0
12k
CQRS/ESになぜアクターモデルが必要なのか
j5ik2o
0
1.2k
Databricks Free Edition講座 データエンジニアリング編
taka_aki
0
2.7k
スクラムマスターが スクラムチームに入って取り組む5つのこと - スクラムガイドには書いてないけど入った当初から取り組んでおきたい大切なこと -
scrummasudar
3
2.2k
Featured
See All Featured
Self-Hosted WebAssembly Runtime for Runtime-Neutral Checkpoint/Restore in Edge–Cloud Continuum
chikuwait
0
290
How to build a perfect <img>
jonoalderson
1
4.8k
Prompt Engineering for Job Search
mfonobong
0
140
Exploring anti-patterns in Rails
aemeredith
2
230
The agentic SEO stack - context over prompts
schlessera
0
590
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.2k
Being A Developer After 40
akosma
91
590k
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
46
2.6k
Tell your own story through comics
letsgokoyo
1
790
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
200
Raft: Consensus for Rubyists
vanstee
141
7.3k
The Psychology of Web Performance [Beyond Tellerrand 2023]
tammyeverts
49
3.3k
Transcript
None
Vitor Mendrone Founder - Lukin Senior Developer - Work &
Co
/^(([^<>()\[\]\.,;:\s@\"]+(\.[^<>()\[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i
None
Expressões Regulares
String Padrões Combinar Localizar Gerenciar
None
Literal Constante Construtor de Objeto Padrão desconhecido
/pattern/flag New RegExp(pattern, flag)
Pattern /meetup-html/g
Flags /meetup-html/g
G Global I Ignore Case M Multiline
.test() .exec()
.test()
.exec()
Meta-characters \d Dígitos (Igual a [0-9]) \w Alfanuméricos e Underline
(Igual a [a-zA-Z0–9_]) \s Espaços e tabs . Qualquer caractere exceto line-breaks
Quantificadores ^ Inicio da string $ Fim da string +
Uma ou mais vezes
Mais Quantificadores {N} N ocorrências da expressão {N,} N ou
mais ocorrências da expressão {N,M} De N a M ocorrências da expressão
Escape / Alternância \ Escapa o próximo caractere (Ex.: \.)
| Ou
Grouping [] Grupo de caracteres () Grupo de captura
None
Validar um CPF!
Validar um CPF! const cpfRegex = //
Definindo uma flag! (Ou Não) const cpfRegex = //
Adicionando limites const cpfRegex = /^$/
NNN.NNN.NNN-NN \d.\d.\d-\d
const cpfRegex = /^\d$/ Meta-characters!
Quantificadores! const cpfRegex = /^\d\d … const cpfRegex = /^\d{3}&/
Escapando! const cpfRegex = /^\d{3}\.$/
const cpfRegex = /^\d{3}\.\d{3}\.\d{3}\-\d{2}$/
https:/ /regexr.com
Obrigado!
[email protected]
Twitter: @vhmendrone