Skip to main content

Regex pattern matching and extraction library for Python.

Project description

pattex

A Python library for extracting common patterns from text using regex — emails, URLs, phone numbers, IP addresses, and more.

Installation

pip install pattex

Changelog

v0.3.0

pattex v0.3.0 brings a significant internal restructuring alongside new features and bug fixes.


Breaking / Structural

  • internet.py has been split into email_extractor.py and url_extractor.py. If you were importing directly from the internal module path, update your imports. Top-level pattex imports are unaffected.

New Features

  • URL Extractionextract_urls(text, mode), extract_urls_by_scheme(text, scheme), and extract_urls_by_domain(text, domain) are now available. Supports strict and permissive modes covering HTTP/S, FTP, WebSocket, IPv4, IPv6, bare domains, and localhost.
  • Gmail normalisationextract_gmail_emails now accepts normalize=True which strips dots from the local part, unifies @googlemail.com to @gmail.com, and deduplicates canonical variants.
  • is_valid_provider_email(email, provider) — single function to validate whether an email belongs to a given provider (gmail, yahoo, outlook, icloud, zoho, proton).

Bug Fixes

  • Fixed extract_emails_by_provider which was not dispatching to provider helper functions correctly — all six providers now route properly.

Status

Currently under active development. Full documentation and usage examples coming soon.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pattex-0.3.0.tar.gz (17.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pattex-0.3.0-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

Details for the file pattex-0.3.0.tar.gz.

File metadata

  • Download URL: pattex-0.3.0.tar.gz
  • Upload date:
  • Size: 17.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for pattex-0.3.0.tar.gz
Algorithm Hash digest
SHA256 376f8a96d4cf6e6f84f14682f4f4a8a028964d257b97c2ff33d218432ce645d6
MD5 557aea717fcb28994744b9a0d800633c
BLAKE2b-256 ab99a6844bc2509213129924990ce7d1cf0e8d1489bcde1046b446c2d6bbdc36

See more details on using hashes here.

File details

Details for the file pattex-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: pattex-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 22.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for pattex-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 139d7205e02d5ac7c959fd39bc458909083dbaf92239bbf63f3a4c83d535a8e8
MD5 1570d7e2c18d5eb7cf666671d1c47bac
BLAKE2b-256 355a327c89b4af407f0b1c11ca4d85d9ed6f1637c923a69194741289353c0770

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page