Verbex: Python verbal based regular expressions
Installation
pip install Verbex
Notes
- Verbex now depends on the
regexpackage (instead of Python's built-inreengine) for faster and more expressive pattern evaluation. - Quantifier methods default to possessive mode for performance (
maybe,zero_or_more,one_or_more,n_times,n_times_or_more,n_to_m_times,anything). - If you need legacy backtracking behavior, pass
possessive=False. - You can set the default quantifier behavior once per expression with
Verbex(default_possessive=False). OR(...)alternates only against the most recently added fragment. Useor_expr(...)to alternate against the full expression.
Usage
from verbex import Verbex
verbex = Verbex()
Documentation
Examples
Testing if we have a valid URL
from verbex import Verbex
# Create an example of how to test for correctly formed URLs
verbex = Verbex()
tester = (verbex.
start_of_line().
find('http').
maybe('s').
find('://').
maybe('www.').
anything_but(' ').
end_of_line()
)
# Create an example URL
test_url = "https://www.google.com"
# Test if the URL is valid
if tester.regex().fullmatch(test_url):
print("Valid URL")
# Print the generated regex
print(tester) # Example: ^http?+://(?:www\.)?+[^ ]+$
Replacing strings
from verbex import Verbex
# Create a test string
replace_me = "Replace bird with a duck"
# Create an expression that looks for the word "bird"
expression = Verbex().find('bird')
# Compile and use the regular expression
regexp = expression.regex()
result_re = regexp.sub('duck', replace_me)
print(result_re)
Developer setup : running the tests
just tests
Other implementations
You can view all implementations on VerbalExpressions.github.io
Metadata
Release files for Verbex 3.0.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 |
|---|---|---|---|---|
| verbex-3.0.0.tar.gz | 25.2 kB | Without provenance | Details for verbex-3.0.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| verbex-3.0.0-py3-none-any.whl | Python 3 | none | any | Details for verbex-3.0.0-py3-none-any.whl |
Total release size: 46.1 kB
Release files / verbex-3.0.0.tar.gz
| Download URL | verbex-3.0.0.tar.gz |
|---|---|
| Size | 25.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c9a51dc5471142e972bf0f0ed8f6fb51ddab6e5c8b68375b6739ad4f112d7ba0
|
|
BLAKE2b-256 checksum How to use checksums |
3badaea282fdc707a27f9fd1f2a2251a5037cbc75da7e95b0e6cd4b53c9356d1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / verbex-3.0.0-py3-none-any.whl
| Download URL | verbex-3.0.0-py3-none-any.whl |
|---|---|
| Size | 20.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c447f928521273a8e95ca6b9e3e7bc14a29521bd21cdd03b2929282aec2b5058
|
|
BLAKE2b-256 checksum How to use checksums |
e2113d34d241c6c84a3d760031be96fca18682628210d23b11ee2793f2cb8403
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for Verbex 3.0.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.