forked from mouredev/roadmap-retos-programacion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
mouredev.py
38 lines (19 loc) · 642 Bytes
/
mouredev.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
import re
"""
Ejercicio
"""
def find_numbers(text: str) -> list:
return re.findall(r"\d+", text)
print(find_numbers("Este es el ejercicio 16 publicado 15/04/2024."))
"""
Extra
"""
def validate_email(email: str) -> bool:
return bool(re.match(r"^[\w.+-]+@[\w]+\.[a-zA-Z]+$", email))
print(validate_email("mouredev@gmail.com"))
def validate_phone(phone: str) -> bool:
return bool(re.match(r"^\+?[\d\s]{3,}$", phone))
print(validate_phone("+34 901 65 89 04"))
def validate_url(url: str) -> bool:
return bool(re.match(r"^http[s]?://(www.)?[\w]+\.[a-zA-Z]{2,}$", url))
print(validate_url("http://www.moure.dev"))