An awesome package to generate regex
Read Documentation
Report Bug
·
Request Feature
Generating regex can sometimes be complicated. That is why we are introducing this package to help you get things done.
Supported functionalities :
- Regex Generation for Numerical Range
1. Regex Generation for Numerical Range
Generate regex given a numerical range, So when given a new number between this range the regex will match.
Person who has motivated me to start this repository is listed in the acknowledgments.
Simply install the package, import it in your python code and run the method needed. Look at the docstring or source code to understand what is happening.
Python 3.6 or greater
pip install regex-engine
You get what you give : If given numbers are integers you get a regex that will only match with integer and if floating-point numbers are given it only match with floating-point number.
Supports integer and floating-point numbers. It can even be a negative range.
from regex_engine import generator
generate = generator()
regex1 = generate.numerical_range(5,89)
regex2 = generate.numerical_range(81.78,250.23)
regex3 = generate.numerical_range(-65,12)
Example regex generated for 25-53
^([3-4][0-9]|2[5-9]|5[0-3])$
The regex might not be optimal but it will surely serve the purpose.
The problem of checking a number is within a range might have been simple if you didn't choose the regex path.
if a <= your_input_number <=b
would have simply solved the same problem.
We dedicate this method in the package to the people who are pursuing a different path or thinking out of the box.
See the open issues for a list of proposed features (and known issues).
Contributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE
for more information.
Raj Kiran P - @raj_kiran_p - rajkiranjp@gmail.com
GitHub : https://github.com/raj-kiran-p
Website : https://rajkiranp.com