Skip to content

Instantly share code, notes, and snippets.

@pbalduino
Forked from anonymous/regex.txt
Last active August 29, 2015 13:59
Show Gist options
  • Save pbalduino/10474063 to your computer and use it in GitHub Desktop.
Save pbalduino/10474063 to your computer and use it in GitHub Desktop.
Para a resposta, basta apresentar a expressão regular utilizada e o parâmetro, caso seja utilizado,
1. Dada uma lista de CEPs válidos, escreva uma expressão regular que funcione com todos os itens:
04567003
04567-003
04.567-003
04.567.003
04 567 003
04567 003
04567.003
2. Dada uma lista de telefones válidos, escreva uma expressão regular que funciona com todos os itens:
998765432
22345678
9.9876.5432
2234.5678
22.34.5678
99876-5432
2234-5678
998-765-432
998.765.432
2234 5678
998 765 432
9 9876 5432
11998765432
1122345678
5511998765432
551122345678
+5511998765432
+551122345678
11 9.9876.5432
11 2234.5678
11 22.34.5678
11 99876-5432
11 9-9876-5432
11 2234-5678
11 998-765-432
11 998.765.432
11 2234 5678
11 22 34 5678
11 998 765 432
11 9 9876 5432
011 9.9876.5432
011 2234.5678
011 22.34.5678
011 99876-5432
011 2234-5678
011 998-765-432
011 998.765.432
(11)9.9876.5432
(11)2234.5678
(11)22.34.5678
(11)99876-5432
(11)2234-5678
(11)998-765-432
(11)998.765.432
(011)9.9876.5432
(011)2234.5678
(011)22.34.5678
(011)99876-5432
(011)2234-5678
(011)998-765-432
(011)998.765.432
(11)9.9876.5432
(11)2234.5678
(11)22.34.5678
(11)99876-5432
(11)2234-5678
(11)998-765-432
(11)998.765.432
(011) 9.9876.5432
(011) 2234.5678
(011) 22.34.5678
(011) 99876-5432
(011) 2234-5678
(011) 2234 5678
(011) 2234 56 78
(011) 22 34 56 78
(011) 998-765-432
(011) 998.765.432
(011) 998 765 432
(0xx11) 9.9876.5432
(0xx11) 2234.5678
(0xx11) 22.34.5678
(0xx11) 99876-5432
(0xx11) 2234-5678
(0xx11) 2234 5678
(0xx11) 2234 56 78
(0xx11) 22 34 56 78
(0xx11) 998-765-432
(0xx11) 998.765.432
(0xx11) 998 765 432
+55(11)9.9876.5432
+55(11)2234.5678
+55(11)22.34.5678
+55(11)99876-5432
+55(11)2234-5678
+55(11)998-765-432
+55(11)998.765.432
+55 (11) 9.9876.5432
+55 (11) 2234.5678
+55 (11) 22.34.5678
+55 (11) 99876-5432
+55 (11) 2234-5678
+55 (11) 2234 5678
+55 (11) 2234 56 78
+55 (11) 22 34 56 78
+55 (11) 998-765-432
+55 (11) 998.765.432
+55 (11) 998 765 432
3. Dadas duas listas de emails, uma com itens válidos e outra com inválidos, escreva uma expressão que selecione TODOS os itens válidos e NENHUM item inválido ou qualquer uma de suas partes.
Válidos:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
user@[IPv6:2001:db8:1ff::a0b:dbd0]
"much.more unusual"@example.com
"[email protected]"@example.com
"very.(),:;<>[]\".VERY.\"very@\\ \"very\".unusual"@strange.example.com
postbox@com
admin@mailserver1
!#$%&'*+-/=?^_`{}|[email protected]
"()<>[]:,;@\\\"!#$%&'*+-/=?^_`{}| ~.a"@example.org
" "@example.org
üñîçøðé@example.com
üñîçøðé@üñîçøðé.com
Inválidos:
Abc.example.com
A@b@[email protected]
a"b(c)d,e:f;g<h>i[j\k][email protected]
just"not"[email protected]
this is"not\[email protected]
this\ still\"not\\[email protected]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment