|
| 1 | +import re |
| 2 | + |
| 3 | +def serparacion(cadena): |
| 4 | + print('{}'.format(cadena * 20)) |
| 5 | + |
| 6 | +telefono_listado = [ |
| 7 | + "+34 601 789 234", |
| 8 | + "+1 (555) 123-4567", |
| 9 | + "+49-170/9876543", |
| 10 | + "+52 81-22-33-44-55", |
| 11 | + "+33 06.12.34.56.78", |
| 12 | + "+86 (10) 8765 4321", |
| 13 | + "+44 7700 900358", |
| 14 | + "+91 987-654-3210", |
| 15 | + "+39 333-1122334", |
| 16 | + "+7 (495) 000-11-22", |
| 17 | + "+61 401 555 121", |
| 18 | + "+81 090-5432-1098", |
| 19 | + "+54 11 4567 8901", |
| 20 | + "+351 961/000-111", |
| 21 | + "+46 70-123 45 67", |
| 22 | + "+55 (21) 98765-4321", |
| 23 | + "+41 79 123 45 67", |
| 24 | + "+82 10-1234-5678", |
| 25 | + "+972 54-888-9999", |
| 26 | + "+27 82 123 4567", |
| 27 | + "+1-555555555" |
| 28 | +] |
| 29 | + |
| 30 | +email_listado = [ |
| 31 | + |
| 32 | + |
| 33 | + |
| 34 | + |
| 35 | + |
| 36 | + |
| 37 | + |
| 38 | + |
| 39 | + |
| 40 | + |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | + |
| 45 | + |
| 46 | + |
| 47 | + |
| 48 | + |
| 49 | + |
| 50 | + "[email protected]" # Un email técnico |
| 51 | +] |
| 52 | + |
| 53 | +url_listado = [ |
| 54 | + "https://www.ejemplo.com/pagina-principal", |
| 55 | + "http://api.servidor.net/v1/data?id=12345", |
| 56 | + "https://docs.organizacion.org/manual/guia-usuario.pdf", |
| 57 | + "https://tienda.com/productos/categoria/item-001", |
| 58 | + "https://blog.personal.dev/2025/11/mi-articulo-fantastico", |
| 59 | + "ftp://descargas.backup.com/archivos/reporte_anual.zip", |
| 60 | + "https://www.redsocial.es/perfil/nombre_usuario_1", |
| 61 | + "https://support.software.net/faq/solucion-problema-x", |
| 62 | + "http://localhost:8080/dashboard", |
| 63 | + "https://universidad.edu/cursos/ingenieria/materia-a", |
| 64 | + "https://images.storage.cloud/fotos/vacaciones/playa-05.jpg", |
| 65 | + "https://noticias24.com/seccion/politica/", |
| 66 | + "https://www.geolocalizacion.maps/lugar/@40.7128,-74.0060,12z", |
| 67 | + "https://repositorio.codigo.git/proyecto-python/src/main.py", |
| 68 | + "https://foro.comunidad.net/thread/500-pregunta-tecnica", |
| 69 | + "https://catalogo.biblioteca.gov/libro/isbn-9781234567890", |
| 70 | + "https://docs.api.empresa.com/endpoints/autenticacion", |
| 71 | + "http://192.168.1.1/admin/configuracion", |
| 72 | + "https://video.streaming.tv/pelicula/id-xyz789", |
| 73 | + "https://www.ejemplo.com/contacto?asunto=consulta&prioridad=alta" |
| 74 | +] |
| 75 | + |
| 76 | +text = "Esto es lo que podemos sacar en conclusión debido a que las 7 naciones están actualmente en guerra con un 33.33 de \ |
| 77 | +pocentaje de porobavilidades de victoria para cada uno de estos 3 paises. 1) Alemania 2) Gran Bretaña 3) España." |
| 78 | + |
| 79 | +def search_numbers(text: str) -> list: |
| 80 | + findallmatch= re.findall(r'\b\d+\.?\d*\b', text) |
| 81 | + print(findallmatch) |
| 82 | + for element in findallmatch: |
| 83 | + print(element) |
| 84 | + |
| 85 | +def search_phone_number(tlfnum): |
| 86 | + tlf_patr = r'(\+\d{1,3})(-|/|\s)?\(?((\d)(-|/|\s|\)\s)?){9}' |
| 87 | + for num in tlfnum: |
| 88 | + tlf = re.match(tlf_patr, num) |
| 89 | + if tlf != None: |
| 90 | + print(tlf.group()) |
| 91 | + |
| 92 | +def search_email(mails): |
| 93 | + mail_patr = r'.*@.*\.\w{2,11}' |
| 94 | + for num in mails: |
| 95 | + mail = re.match(mail_patr, num) |
| 96 | + if mail != None: |
| 97 | + print(mail.group()) |
| 98 | + |
| 99 | +def search_url(urls): |
| 100 | + url_patr = r'http(s?)://.*\..*\..*/*' |
| 101 | + for num in urls: |
| 102 | + url = re.match(url_patr, num) |
| 103 | + if url != None: |
| 104 | + print(url.group()) |
| 105 | + |
| 106 | + |
| 107 | +def main(): |
| 108 | + print() |
| 109 | + search_numbers(text) |
| 110 | + serparacion('-:-:-:') |
| 111 | + search_phone_number(telefono_listado) |
| 112 | + serparacion('-:-:-:') |
| 113 | + search_email(email_listado) |
| 114 | + serparacion('-:-:-:') |
| 115 | + search_url(url_listado) |
| 116 | + serparacion('-:-:-:') |
| 117 | + |
| 118 | +main() |
0 commit comments