-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathregex_biblioteca.py
57 lines (57 loc) · 1.51 KB
/
regex_biblioteca.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
import re
def validatelefone(telefone):
target=telefone
pattern=re.compile("^\(?[0-9]{0,2}\)?[\s\S]?[0-9]{5}[\-]?[0-9]{4}$")
match= re.fullmatch(pattern,target)
if(match!=None):
return True
else:
return False
def validacpf(cpf):
target=cpf
pattern=re.compile("^[0-9]{3}[.]?[0-9]{3}[.]?[0-9]{3}[-]?[0-9]{2}$")
match= re.fullmatch(pattern,target)
if(match!=None):
return True
else:
return False
def validamat(matricula):
target=matricula
pattern=re.compile("[0-9]*")
match= re.fullmatch(pattern,target)
if(match!=None):
return True
else:
return False
def validaid(id):
target=id
pattern=re.compile("^[0-9A-z]{1,5}$")
match= re.fullmatch(pattern,target)
if(match!=None):
return True
else:
return False
def validanome(nome):
target=nome
pattern=re.compile("[A-zÁ-úÂ-ôÃ-õ]+[\s\S]*")
match= re.fullmatch(pattern,target)
if(match!=None):
return True
else:
return False
def validacategoriaLivro(categoria):
target=categoria
pattern=re.compile("[A-zÁ-úÂ-ôÃ-õ]+[\s\S]*")
match= re.fullmatch(pattern,target)
if(match!=None):
return True
else:
return False
def validadata(data):
target=data
pattern=re.compile("[0-9]{1,2}[/-][0-9]{1,2}[/-][0-9]{4}")
match= re.fullmatch(pattern,target)
if(match!=None):
return True
else:
return False