philiprehberger-regex-kit
Pre-built, tested regex patterns for common data formats.
Installation
pip install philiprehberger-regex-kit
Usage
from philiprehberger_regex_kit import patterns, extract, is_match
# Use compiled patterns directly
if patterns.EMAIL.fullmatch("user@example.com"):
print("Valid email")
# Quick validation by name
is_match("ip_v4", "192.168.1.1") # True
is_match("uuid", "not-a-uuid") # False
Extracting Matches
from philiprehberger_regex_kit import extract
text = "Contact alice@example.com or visit https://example.com"
extract.emails(text) # ["alice@example.com"]
extract.urls(text) # ["https://example.com"]
Available Patterns
from philiprehberger_regex_kit import patterns
patterns.EMAIL # Email addresses
patterns.URL # HTTP/HTTPS URLs
patterns.IP_V4 # IPv4 addresses
patterns.IP_V6 # IPv6 addresses (full form)
patterns.PHONE # Phone numbers
patterns.UUID # UUIDs
patterns.HEX_COLOR # Hex color codes (#fff, #ff00aa)
patterns.DATE_ISO # ISO dates (YYYY-MM-DD)
patterns.TIME_24H # 24-hour time (HH:MM or HH:MM:SS)
patterns.CREDIT_CARD # Credit card numbers
patterns.MAC_ADDRESS # MAC addresses
patterns.DOMAIN # Domain names
API
patterns
| Attribute | Description |
|---|---|
patterns.EMAIL |
Compiled pattern for email addresses |
patterns.URL |
Compiled pattern for HTTP/HTTPS URLs |
patterns.IP_V4 |
Compiled pattern for IPv4 addresses |
patterns.IP_V6 |
Compiled pattern for IPv6 addresses |
patterns.PHONE |
Compiled pattern for phone numbers |
patterns.UUID |
Compiled pattern for UUIDs |
patterns.HEX_COLOR |
Compiled pattern for hex color codes |
patterns.DATE_ISO |
Compiled pattern for ISO 8601 dates |
patterns.TIME_24H |
Compiled pattern for 24-hour time |
patterns.CREDIT_CARD |
Compiled pattern for credit card numbers |
patterns.MAC_ADDRESS |
Compiled pattern for MAC addresses |
patterns.DOMAIN |
Compiled pattern for domain names |
extract
| Method | Description |
|---|---|
extract.emails(text) |
Extract all email addresses |
extract.urls(text) |
Extract all URLs |
extract.phones(text) |
Extract all phone numbers |
extract.ips(text) |
Extract all IPv4 addresses |
extract.uuids(text) |
Extract all UUIDs |
is_match(pattern_name, value)
| Parameter | Description |
|---|---|
pattern_name |
Pattern name string (e.g. "email", "ip_v4", "uuid") |
value |
The string to validate |
| Returns | bool — True if the entire value matches |
Development
pip install -e .
python -m pytest tests/ -v
Support
If you find this project useful:
License
Metadata
Release files for philiprehberger-regex-kit 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| philiprehberger_regex_kit-0.2.0.tar.gz | 6.5 kB | Without provenance | Details for philiprehberger_regex_kit-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| philiprehberger_regex_kit-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for philiprehberger_regex_kit-0.2.0-py3-none-any.whl |
Total release size: 11.6 kB
Release files / philiprehberger_regex_kit-0.2.0.tar.gz
| Download URL | philiprehberger_regex_kit-0.2.0.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fa196194ede508f54053c6a00fa78a2d7a268a0d92842fba32bb87149c6583fb
|
|
BLAKE2b-256 checksum How to use checksums |
37af3709513c1f11ba1c40a52c580351350cba3fac4a5701f111c5fae13116e9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Release files / philiprehberger_regex_kit-0.2.0-py3-none-any.whl
| Download URL | philiprehberger_regex_kit-0.2.0-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f9783426f7200306dd3ad5a3d29e4892793d8b2c6648114cc82cd3b1cabbcfc2
|
|
BLAKE2b-256 checksum How to use checksums |
a00508182af5f1a2f06e696569cb48fe3dce01b5c342a2b1a93637cbd8131dc3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.13
|
Security for philiprehberger-regex-kit 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.