Skip to content

Commit ae196c6

Browse files
committed
#16 - python
1 parent e8553ee commit ae196c6

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import re
2+
3+
#Ejercicio
4+
5+
regex = r"\d+"
6+
7+
text = "Este es el ejercicio 16 a fecha del 22 de enero de 2025."
8+
9+
def find_numbers(text:str) -> list:
10+
return re.findall(regex, text)
11+
12+
print(find_numbers(text))
13+
14+
15+
#EJERCICIO EXTRA
16+
17+
def validate_email(email: str) -> bool:
18+
return bool(re.match(r"^[\w.+-]+@[\w]+\.[a-zA-Z]+$", email))
19+
20+
21+
print(validate_email("[email protected]"))
22+
23+
24+
def validate_phone(phone: str) -> bool:
25+
return bool(re.match(r"^\+?[\d\s]{3,}$", phone))
26+
27+
28+
print(validate_phone("+34 901 65 89 044"))
29+
30+
31+
def validate_url(url: str) -> bool:
32+
return bool(re.match(r"^http[s]?://(www.)?[\w]+\.[a-zA-Z]{2,}$", url))
33+
34+
35+
print(validate_url("http://www.moure.dev"))

0 commit comments

Comments
 (0)