Untitled
unknown
python
5 months ago
874 B
3
Indexable
import pyperclip import re def find_poland_number(text): # Wyrażenie regularne dla numerów telefonów w formacie: # - +48 xxx xxx xxx # - xxx-xxx-xxx # - +48 xxx-xxx-xxx pattern = r'(\+48\s?\d{3}[\s-]?\d{3}[\s-]?\d{3}|\d{3}[\s-]?\d{3}[\s-]?\d{3})' phone_numbers = re.findall(pattern, text) return phone_numbers def find_emails(text): pattern = r'[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}' email_addresses = re.findall(pattern, text) return email_addresses if __name__ == '__main__': t = pyperclip.paste() emails = find_emails(t) if emails: emails_to_clipboard = "\n".join(emails) pyperclip.copy(emails_to_clipboard) print("Znaleziono i skopiowano emaile:" ) # print(emails_to_clipboard) else: print("Nie znaleziono emailów.")
Editor is loading...
Leave a Comment