Skip to main content

Maker Regular Expression

PyPI

This is a simple package to make regular expressions in Python.

pip install mre

Documentation

Examples

from mre import Regex, Group

rgx_one = Regex("Hello world")  # Hello world
rgx_two = Regex("Hello", " world")  # Hello world
rgx_three = Regex("Hello") + " " + Regex("world")  # Hello world
rgx_four = Regex('<', Group('h[1-6]'), '>')  # <(h[1-6])>
rgx_five = Regex('<', Regex.SLASH, 1, '>')  # <\/\1>
from mre import Set
from mre.helper import Range

# All digits
digits = Set(Range(0, 9))
# Add comment
digits = digits.comment('Get all digits')

# Output: [0-9](?#Get all digits)
from mre import Regex, Set, Comment

# All digits
digits = Set(Regex("0-9"))
# CEP comment
cep_comment = Comment('Get zip code Brazil on input')
# CEP regex
rgx_cep = Regex(
    digits.quantifier(5),
    Regex("-").quantifier(0, 1),
    digits.quantifier(3),
    cep_comment
)

# Output: [0-9]{5}-?[0-9]{3}(?#Get zip code Brazil on input)

Tests

To test the package just run the following command:

# (first time only) Build the Docker image
make build

# Run tests
make test

# Run tests and check coverage
make test-coverage

Contributing

Contributions are more than welcome. Fork, improve and make a pull request. For bugs, ideas for improvement or other, please create an issue.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for mre 0.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mre 0.12.0
File Size Uploaded Provenance
mre-0.12.0.tar.gz 5.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for mre 0.12.0
File Interpreter ABI Platform
mre-0.12.0-py3-none-any.whl Python 3 none any Details

Total release size: 13.8 kB

Release files / mre-0.12.0.tar.gz

Download URL mre-0.12.0.tar.gz
Size 5.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2cb6d348378dcc1a74853763e8ef47ac2b1e571b3a172ce829fc36cf7e143811
BLAKE2b-256 checksum
How to use checksums
8e79ef7154db615fc1f18ff7122578b2961119e40e87a8a0574c542d10eb3f52
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.8.2 requests/2.26.0 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Release files / mre-0.12.0-py3-none-any.whl

Download URL mre-0.12.0-py3-none-any.whl
Size 7.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
aad02e5bed197ffbd0bd388ea5cced6476f364d691e649e3f81143edbe129c30
BLAKE2b-256 checksum
How to use checksums
48602fd125b951bcbb546ac05bcc8be68e1391f227cbfda0f570088be23740cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.8.2 requests/2.26.0 setuptools/52.0.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.7

Security for mre 0.12.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page