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.pyhas been split intoemail_extractor.pyandurl_extractor.py. If you were importing directly from the internal module path, update your imports. Top-levelpatteximports are unaffected.
New Features
- URL Extraction —
extract_urls(text, mode),extract_urls_by_scheme(text, scheme), andextract_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 normalisation —
extract_gmail_emailsnow acceptsnormalize=Truewhich strips dots from the local part, unifies@googlemail.comto@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_providerwhich 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
376f8a96d4cf6e6f84f14682f4f4a8a028964d257b97c2ff33d218432ce645d6
|
|
| MD5 |
557aea717fcb28994744b9a0d800633c
|
|
| BLAKE2b-256 |
ab99a6844bc2509213129924990ce7d1cf0e8d1489bcde1046b446c2d6bbdc36
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
139d7205e02d5ac7c959fd39bc458909083dbaf92239bbf63f3a4c83d535a8e8
|
|
| MD5 |
1570d7e2c18d5eb7cf666671d1c47bac
|
|
| BLAKE2b-256 |
355a327c89b4af407f0b1c11ca4d85d9ed6f1637c923a69194741289353c0770
|