forked from luizomf/regexp-python
-
Notifications
You must be signed in to change notification settings - Fork 0
/
aula11.py
35 lines (30 loc) · 893 Bytes
/
aula11.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# https://regex101.com/r/0OM1oz/1/
import re
from pprint import pprint
regex = re.compile(
r"^(?!(\d)\1{2}\.\1{3}\.\1{3}-\1{2})(\d{3}\.\d{3}\.\d{3}-\d{2})$",
flags=re.MULTILINE
)
test_str = ("698.547.520-54\n"
"060.235.190-16\n"
"683.134.960-96\n"
"899.344.730-62\n"
"103.778.870-21\n"
"721.478.580-30\n"
"366.310.090-14\n"
"794.289.350-26\n"
"190.259.410-01\n"
"000.000.000-01\n"
"900.000.000-00\n\n"
"000.000.000-00\n"
"111.111.111-11\n"
"222.222.222-22\n"
"333.333.333-33\n"
"444.444.444-44\n"
"555.555.555-55\n"
"666.666.666-66\n"
"777.777.777-77\n"
"888.888.888-88\n"
"999.999.999-99\n\n"
)
pprint(regex.findall(test_str))