Maker Regular Expressions
Project description
Maker Regular Expression
This is a simple package to make regular expressions in Python.
pip install mre
- Test regex: Regex101;
- Regular expression operations.
Documentation
- da-DK :denmark: (v. 0.8)
- de-DE :de: (v. 0.8)
- en-US :us: (v. 0.9)
- es-ES :es: (v. 0.8)
- pt-BR :brazil: (v. 0.11)
- ru-RU :ru: (v. 0.8)
- uk-UA :ukraine: (v. 0.8)
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.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mre-0.12.0.tar.gz.
File metadata
- Download URL: mre-0.12.0.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2cb6d348378dcc1a74853763e8ef47ac2b1e571b3a172ce829fc36cf7e143811
|
|
| MD5 |
174173ec88f1c6b40b7421aaaa534bf0
|
|
| BLAKE2b-256 |
8e79ef7154db615fc1f18ff7122578b2961119e40e87a8a0574c542d10eb3f52
|
File details
Details for the file mre-0.12.0-py3-none-any.whl.
File metadata
- Download URL: mre-0.12.0-py3-none-any.whl
- Upload date:
- Size: 7.9 kB
- Tags: Python 3
- Uploaded using 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
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aad02e5bed197ffbd0bd388ea5cced6476f364d691e649e3f81143edbe129c30
|
|
| MD5 |
280e8d6c345c14f26cf1bcbbf5f55680
|
|
| BLAKE2b-256 |
48602fd125b951bcbb546ac05bcc8be68e1391f227cbfda0f570088be23740cf
|