No project description provided
Project description
RGXX - Natural Language Regex Generator
A minimal Python library powered by Rust and PyO3 for generating regular expressions using natural language chainable functions.
Overview
This project provides a Python library that simplifies the creation of regular expressions by using a natural language syntax. It leverages Rust's performance and safety, with PyO3 bridging Rust and Python, to deliver an ultra-minimal runtime with zero dependencies.
Features
- Zero-Dependency and Ultra-Minimal Runtime: Designed to be lightweight with no external dependencies, ensuring fast execution and minimal overhead.
- Pure RegExp Compilation: Generates standard regular expressions compatible with Python's
remodule and other regex engines. - Automatically Typed Capture Groups: Easily define named capture groups that are automatically recognized, simplifying pattern matching and data extraction.
- Natural Language Syntax: Utilize chainable functions that read like natural language, enhancing code readability and maintainability.
- IDE Support: Generated regular expressions display on hover in supported IDEs, aiding in development and debugging.
Installation
Install the library using pip:
pip install rgxx
Usage
Here's how you can use the library to create a regular expression for matching dates in the YYYY-MM-DD format:
python
Copy code
from rgxx import digit, exactly, any_of, RegExp
# Define the components of the date pattern
year = digit().times(4).grouped_as('year')
month = any_of(
exactly('0') & digit(),
exactly('10'), exactly('11'),
exactly('12')
).grouped_as('month')
day = any_of(
exactly('0') & digit(),
exactly('1') & digit(),
exactly('2') & digit(),
exactly('30'), exactly('31')
).grouped_as('day')
# Combine the components into a single RegExp object
date_pattern = RegExp(year, exactly('-'), month, exactly('-'), day)
print(date_pattern.compile())
Output:
`(?P<year>(\d){4})\-(?P<month>((0)\d|10|11|12))\-(?P<day>((0)\d|(1)\d|(2)\d|30|31))`
Example Usage with Python's **re** Module:
import re
# Compile the generated regular expression
date_regex = re.compile(date_pattern.compile())
# Match a date string
match = date_regex.match('2023-10-05')
if match:
print(match.group('year')) # Output: 2023
print(match.group('month')) # Output: 10
print(match.group('day')) # Output: 05
Documentation
**digit()**: Matches any single digit (\d).**exactly(s)**: Matches the exact strings, escaping special regex characters.**any_of(*patterns)**: Matches any one of the provided patterns.- Chaining Methods:
**.times(n)**: Repeats the pattern exactlyntimes.**.grouped_as(name)**: Names the capture group asname.**.and(other)**or**&**: Concatenates the current pattern with another.
Contributing
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Commit your changes with clear messages.
- Open a pull request describing your changes.
License
This project is licensed under the MIT License.
Feel free to customize this bio further to suit your project's specific details or to add more sections such as acknowledgments, FAQs, or a roadmap.
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 Distributions
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 rgxx-0.1.12.tar.gz.
File metadata
- Download URL: rgxx-0.1.12.tar.gz
- Upload date:
- Size: 6.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfb6e9f17d5a749df303b505e8aa67445e2e8ffdb104ebc295d78bfcb802fbd4
|
|
| MD5 |
b2a6edce3162b1df6454ed04c30501a1
|
|
| BLAKE2b-256 |
e5b78a1db854c86434d4740467742b3187f87357e8d75ed073823f843629291e
|
File details
Details for the file rgxx-0.1.12-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: rgxx-0.1.12-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 133.5 kB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5eabe472a44a1a079172800fc5fff6ec68220e619f2042ab150510cdbc62cf5a
|
|
| MD5 |
fd0d45cab12145a35e40f11e42fb36a1
|
|
| BLAKE2b-256 |
c767ffff2c74f8e3459fc5c45775c542a25fffde1f36e853c99883c84e81268a
|
File details
Details for the file rgxx-0.1.12-cp39-abi3-win32.whl.
File metadata
- Download URL: rgxx-0.1.12-cp39-abi3-win32.whl
- Upload date:
- Size: 124.8 kB
- Tags: CPython 3.9+, Windows x86
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
61f4ea29e571b1d6955413e233bf7d2baa338951519a84ddf322764a86d564ab
|
|
| MD5 |
7893a831b1bbc807aa6c77faa2483cfb
|
|
| BLAKE2b-256 |
ffb8b7eff6cc7b71667d2f17d2dcc43577749d88dc1e8cba7a56c776a572994f
|
File details
Details for the file rgxx-0.1.12-cp39-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: rgxx-0.1.12-cp39-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 432.7 kB
- Tags: CPython 3.9+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
78aacd70bc6123be660e5a204f2ec76a10e695d0e0d41c27b8bc56d61fbe19e3
|
|
| MD5 |
22f7ce18e1f6c5c579d2d388688023ec
|
|
| BLAKE2b-256 |
5bd109635c860d7c39021b84e844fb51489dd1527851b76e1c760a5057788c3a
|
File details
Details for the file rgxx-0.1.12-cp39-abi3-musllinux_1_2_i686.whl.
File metadata
- Download URL: rgxx-0.1.12-cp39-abi3-musllinux_1_2_i686.whl
- Upload date:
- Size: 454.6 kB
- Tags: CPython 3.9+, musllinux: musl 1.2+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a35c89e9714be26f598e7cdca4fd6af8f65fad2888648d79f0bf836792a192b3
|
|
| MD5 |
c56d59da0e364b6ca4dfb61504e6b145
|
|
| BLAKE2b-256 |
24c94fd719fc8f979387b9e5a61926aa0a62784917752b12d2c31567beefa624
|
File details
Details for the file rgxx-0.1.12-cp39-abi3-musllinux_1_2_armv7l.whl.
File metadata
- Download URL: rgxx-0.1.12-cp39-abi3-musllinux_1_2_armv7l.whl
- Upload date:
- Size: 531.9 kB
- Tags: CPython 3.9+, musllinux: musl 1.2+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
017873d272b85461cbe02f8c77e1958e5ca734f7ffa9ed1c27ba6cf4a894b3ba
|
|
| MD5 |
0e01e504487701678ea9c13c6d7c53bd
|
|
| BLAKE2b-256 |
94bee5f9b5b41532ecb03a1bedb17113d4ec3b1e54e36ad1631ae3c976cd5ff0
|
File details
Details for the file rgxx-0.1.12-cp39-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: rgxx-0.1.12-cp39-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 448.6 kB
- Tags: CPython 3.9+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
300ad2fdecd5de372fac53c704ee5222b92b8ff21ba9b132706c6525ee8cbbdf
|
|
| MD5 |
42387b3416274d0569dc00990300e663
|
|
| BLAKE2b-256 |
b013b9527389a63d2c1dd36a484eb5bc74920b6f5d49dde7c1eb73ca7953bd3e
|
File details
Details for the file rgxx-0.1.12-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: rgxx-0.1.12-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 264.2 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e27085a88941200035f86d04f04640eea8fc80728a0668d3ffac72a67634abf3
|
|
| MD5 |
e6fb8d1f448ac5a04f29f1fb74e15efa
|
|
| BLAKE2b-256 |
73d4803a6c2a56b04524dd0734e31c8f7d82b66393a34858247bf553500b6604
|
File details
Details for the file rgxx-0.1.12-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl.
File metadata
- Download URL: rgxx-0.1.12-cp39-abi3-manylinux_2_17_s390x.manylinux2014_s390x.whl
- Upload date:
- Size: 308.1 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ s390x
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bea9eb9687f5dfa3b55aaf99a46e09124b47a421c96889c04f7a45e481adda4a
|
|
| MD5 |
203af3c711784340152df94495f644d1
|
|
| BLAKE2b-256 |
43aa2199793bc2433864411e8696e581004688e7acef19b34923e3dca312cb98
|
File details
Details for the file rgxx-0.1.12-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl.
File metadata
- Download URL: rgxx-0.1.12-cp39-abi3-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl
- Upload date:
- Size: 302.0 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ppc64le
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
188a0a71d79dfa63b744918e1ce806a20500c9111140b8955a530e2ee8269035
|
|
| MD5 |
00d1d9e6b9ffa18736b256183fc3716f
|
|
| BLAKE2b-256 |
0168ba671d25685da3b26c163cdc76184751c7fe306ad63293ea56c6256227a9
|
File details
Details for the file rgxx-0.1.12-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl.
File metadata
- Download URL: rgxx-0.1.12-cp39-abi3-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
- Upload date:
- Size: 274.9 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARMv7l
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82da31fea2e7dce9be4946d78fe4988c6f5a958dfcfa940a4b952d1971e959e9
|
|
| MD5 |
ece89e5280f8ebc9d9ec9264347c3b42
|
|
| BLAKE2b-256 |
71006c18680b43a6db43fde3954add11b76f8bcb2b13937ed86cc09a5a2a459a
|
File details
Details for the file rgxx-0.1.12-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: rgxx-0.1.12-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 272.6 kB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46632899bde2d99f0a17559e3f5fa38cd84d5d4dbb99df7867506b7b8df054b5
|
|
| MD5 |
ae7a546b4eb51745593e546626d7192d
|
|
| BLAKE2b-256 |
97ab277ea5764cf30325b599fdf95e7d7356bbb8ff753ede8b3d9133dff57916
|
File details
Details for the file rgxx-0.1.12-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl.
File metadata
- Download URL: rgxx-0.1.12-cp39-abi3-manylinux_2_5_i686.manylinux1_i686.whl
- Upload date:
- Size: 279.4 kB
- Tags: CPython 3.9+, manylinux: glibc 2.5+ i686
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e5b0d7542e8d01f4ed666837bcdb6785c9246b002c1071c18f3f4094f5805c4b
|
|
| MD5 |
0e78e5d381b137ebb161ded28d569ee7
|
|
| BLAKE2b-256 |
126ab39e18b8f3be0b4ffe0737cc7b53b1cae391cf39e97cd1d95fe48157ee32
|
File details
Details for the file rgxx-0.1.12-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: rgxx-0.1.12-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 228.0 kB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0ee7fbc3ae61897d9aa2d46818f88e11d440dc1746f8bf053f0fbb7990bff648
|
|
| MD5 |
98bd36194f96da3818a83c97c94f2d39
|
|
| BLAKE2b-256 |
c77f8df0922d792db51acc90ac7fcd4ce75c92497a3d1d158d9d9a9e6ffa6344
|
File details
Details for the file rgxx-0.1.12-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: rgxx-0.1.12-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 233.0 kB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1cce4c3bceb6552d7ff2df3f156d99362b121519cf3c3c91e84147594ba7c860
|
|
| MD5 |
0e01c17202b63d6a583898c06cfc0faa
|
|
| BLAKE2b-256 |
1253a40752045e665736cb251209555028353a6eb86697bc848715588e2b2521
|