Regular regexes
The goal of this repo is avoid having to look up commonly used regexes, but have them all bundled in a single place. The focus is on identifiers useful in investigations: identity documents, bank and company numbers, payment cards, phones and SIMs, crypto addresses and seed phrases, vehicles, aircraft, ships, containers and parcels, locations, messaging and file-share links, keys and tokens.
Usage
Install the package using pip install regular-regexes
from regular_regexes import rre
rre.email("mail me at jan@test.com or piet@test.be") # ['jan@test.com', 'piet@test.be']
rre.be.license_plate("car 1-ABC-123") # ['1-ABC-123']
rre.be.iban("BE68 5390 0754 7035") # [] (checksum fails)
Every function takes a string and returns the list of matched strings.
rre.ios_system_path and rre.android_system_path take a path on the device and match
it when it lies in a folder the OS keeps for itself (read-only, the same on every phone of a version, nothing the user
made): iOS's system volume (/System/, /Library/, /Applications/, /Developer/, /usr/, /bin/, /sbin/) and
/private/preboot/Cryptexes/; Android's /system/, /system_ext/, /system_root/, /product/, /vendor/, /odm/,
/oem/, /apex/, /bin/, /sbin/. Only at the start of the path, case-sensitive: /data/system/... or
/private/var/mobile/Library/... (user data) do not match. rre.ios_app_bundle_path does the same for the folder where
iOS installs apps, /private/var/containers/Bundle/: what the app ships, not what the user made in it (that is in
/private/var/mobile/Containers/Data/Application/..., which does not match).
Three more match folders in the user's data where the audio is not the user's own: rre.speech_synthesis_path (text-to-speech
caches and voices: Library/Caches/tts/ in an iOS app's data, Android's com.google.android.tts, a navigation app's
tts/ or voice/ folder), rre.app_sound_path (an app's notification and effect sounds: Library/Sounds/ in an iOS
app's data, a navigation app's sound/ folder) and rre.ios_voice_trigger_path (/private/var/mobile/Library/VoiceTrigger/,
the owner's recordings of the assistant's wake phrase). Exact folders only: an app's cache as such does not match.
rre.ios_system_path("/System/Library/PrivateFrameworks/x.caf") # ['/System/Library/PrivateFrameworks/x.caf']
rre.android_system_path("/data/system/usagestats/0") # []
Universal regexes are on rre directly, country specific ones under their two letter country code: be, de, es,
fr, gb (United Kingdom), it, lu, nl, pl and ro. National formats overlap (a Belgian 0495 12 34 56 is
also a valid Dutch number), so run the countries that fit the case.
Where an identifier has a checksum (IBAN, national number, Luhn, crypto addresses, MRZ, ...) the match is also
validated, so random numbers of the right shape are dropped. Phone numbers are checked against libphonenumber's
numbering plans (the phonenumbers package, installed along). Numbers whose bare shape is too common to tell apart are
only matched next to their keyword, which is part of the match:
rre.nl.bsn("BSN: 999999990, bare 999999990") # ['BSN: 999999990']
Available regexes
All regexes, their patterns and checksum validators, with search:
regexes.upshift.be.
The site is generated from the regexes.json files and their descriptions in docs/descriptions/, and Netlify
publishes it on every push to main; to preview it locally:
pip install -r docs/requirements.txt
mkdocs serve
Adding regexes
Universal regexes go in regular_regexes/intl/regexes.json. Country specific ones go in regular_regexes/<country code>/regexes.json
(e.g. regular_regexes/be/regexes.json). A new country folder is picked up automatically. For the documentation
site, a regex also needs a one-line description in docs/descriptions/<country code>.json and a category in
docs/categories.json; the docs build fails without them.
A regex can be paired with a checksum validator from regular_regexes/validators.py; matches that fail it are dropped:
"iban": {"regex": "...", "validator": "iban"}
A validator returns whether the match is valid, or the valid part of it as a string (how a seed phrase is cut out of a
longer run of words), and never raises. Any other key in the entry is passed on to the validator
("validator": "phone", "regions": "BE", "kind": "mobile"). A data file it needs (like the BIP39 word list) also goes
in package_data in setup.cfg.
Tests live in the same layout: tests/<country code>/test_regexes.py and tests/intl/test_regexes.py.
Run them with pytest, after pip install -e . (which also installs phonenumbers).
Every regex has at least six matching and six non-matching cases. The suite also runs every match through every
other regex: when two regexes match the same text, tests/overlaps.json must say why that is inherent, or the run
fails. After a deliberate change, pytest --overlaps-update rewrites that file; fill in the reason of new pairs.
Metadata
Release files for regular-regexes 0.1.3
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 |
|---|---|---|---|---|
| regular_regexes-0.1.3.tar.gz | 55.1 kB | With provenance | Details for regular_regexes-0.1.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| regular_regexes-0.1.3-py3-none-any.whl | Python 3 | none | any | Details for regular_regexes-0.1.3-py3-none-any.whl |
Total release size: 112.1 kB
Release files / regular_regexes-0.1.3.tar.gz
| Download URL | regular_regexes-0.1.3.tar.gz |
|---|---|
| Size | 55.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d991182ad47257da724136aa033f338504f60a86eec4fa593b06da790634cd40
|
|
BLAKE2b-256 checksum How to use checksums |
58d2c3254e51fa553bc80eb5617f8042a63b4f8ec55f152e6b9dece31cc218b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logRelease files / regular_regexes-0.1.3-py3-none-any.whl
| Download URL | regular_regexes-0.1.3-py3-none-any.whl |
|---|---|
| Size | 57.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cbbafd36a301a59b7073fb9ceda82f6c087e128fadf3533df5441d83df68d0ca
|
|
BLAKE2b-256 checksum How to use checksums |
ba861eaa8e0edca331d664442cb5597c4baa473e3e038343d1088b130f416436
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logSecurity for regular-regexes 0.1.3
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for regular_regexes-0.1.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.
Transparency logA 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.