meaningful_re
Regular expression builder with chainable methods.
Instead of having to read and figure out the meaning of those weird strings, you can use an object to build your regex with methods with more sense.
Example
Let's say you want to make a regular expression like r'^[hc]at$', you can do it like this:
from meaningful_re import MeaningfulRE as MRE
mre = (MRE('[hc]')
.concat('at')
.match_start
.match_end)
print mre.regex
Note: It doesn't matter if you use
match_startormatch_endat the beginning, middle or end of you chaining methods, when you show theregexthey will be in their corresponding string position.
Or if you want to make an email regular expression like r'\b[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}\b', not everybody can read that, but, with meaningful_re it makes more sense doing it.
from meaningful_re import MeaningfulRE as MRE
mre = (MRE()
.word_boundary
.any_of(MRE.RANGE_UPPERCASE_ALPHABET, MRE.RANGE_NUMBERS, '._%+-')
.concat('+@')
.any_of(MRE.RANGE_UPPERCASE_ALPHABET, MRE.RANGE_NUMBERS, '.-')
.concat('+\.')
.any_of(MRE.RANGE_UPPERCASE_ALPHABET).at_least(2)
.word_boundary)
Another example using capturing group, if you would like to match all string starting with IMG and ending with either .png or jpeg like r'^(IMG\d+)\.(png|jpeg)$', can be built this way:
from meaningful_re import MeaningfulRE as MRE
mre = (MRE()
.match_start
.gi
.one_or_more('IMG' + MRE.DIGIT)
.ge
.concat('\.')
.gi
.or_('png', 'jpeg')
.ge)
Metadata
Release files for meaningful-re 0.1.24
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 | |
|---|---|---|---|---|
| meaningful_re-0.1.24.tar.gz | 3.6 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| meaningful_re-0.1.24-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.7 kB
Release files / meaningful_re-0.1.24.tar.gz
| Download URL | meaningful_re-0.1.24.tar.gz |
|---|---|
| Size | 3.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3b49580a2966488067a0ccc6829d937c3269ed3546e04b6ea7d0eb862ce9b790
|
|
BLAKE2b-256 checksum How to use checksums |
1de096f88bb8fe3c89fad12f82e0c6b877b235b8f6a6d577d4836bdbe6a19bd7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.3.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.9
|
Release files / meaningful_re-0.1.24-py3-none-any.whl
| Download URL | meaningful_re-0.1.24-py3-none-any.whl |
|---|---|
| Size | 5.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
570daccdd0b62d85fbc29c0be20de56cdc3cf414bce2a06a738edc62b38ee6ce
|
|
BLAKE2b-256 checksum How to use checksums |
8c24a35fe4b704ef4d9c66741de22d9511d2aae6efe93f8152a3a7766f31521b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.12.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/46.3.0 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.6.9
|
Security for meaningful-re 0.1.24
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.