yet another regex based text generation library
Project description
regenx
regenx is yet another regex based text generation library
Table of Contents
Installation
pip install regenx
Features
This library currently supports generating all the possible strings that would match the given regex.
Supported syntax
. character (it will include all ascii printable characters)
\ escape sequences
all the special ones are ascii only
the negative (uppercase) special escapes will include all ascii printable characters minus the specified ones
\ddigits, same as[0-9]\Dnon digits, same as[^0-9]\swhitespace, same as[ \t\n\r\f\v]\Snon whitespace, same as[^ \t\n\r\f\v]\wsame as[a-zA-Z0-9_]\Wsame as[^a-zA-Z0-9_]\aascii bell (BEL)\bascii backspace (BS)\fascii formfeed (FF)\nascii linefeed (LF)\rascii carriage return (CR)\tascii horizontal tab (TAB)\vascii vertical tab (VT)
numerical escape sequences:
the positive integer number given will be converted to the associated character
\ooctal escape sequence, note: must be 3 digits long, this is different to the standard\<octal_number>to distinguish it from back references\x8bit hexadecimal escape sequence, note: must be 2 digits long\u16bit hexadecimal escape sequence, note: must be 4 digits long\U32bit hexadecimal escape sequence, note: must be 8 digits long
all other escaped characters will be treated as themselves
[] sets
- the
^modifier will include all ascii printable characters minus the specified ones - the
-range modifier will include all characters with integer values between and including the ranges specified
() groups (modifiers are not yet supported)
| or sequences, inside or outside groups
Limitations
some features of regex do not make sense and will be ignored:
- boundary assertion character (
^and$) - all the beginning or end of word escape sequences
- greedy and non greedy modifiers for counts (
+and?),
maybe in future they could be used to set the generation order
limits by design, they may be supported if there is a reason to
- unlimited counts such as
*+
this is because i feel that generating an infinitely long string is mostly useless and it would complicate the parsing process more abstract and less easily serializable,
you are welcome to convince me otherwise. - group modifiers
is there a point for those for our scope?
See also
inspired by: janstarke/rexgen
friends: Buba98/regex_enumerator (yes we know each other)
License
regenx is distributed under the terms of the MIT license.
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 regenx-0.0.2.tar.gz.
File metadata
- Download URL: regenx-0.0.2.tar.gz
- Upload date:
- Size: 11.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8161e49622fccec0d5a14cb6b2a19a4a2e176a4d832a38d5a904ef57d7945cbb
|
|
| MD5 |
3dd3c2cdff2bcee4b8d58b8528972cee
|
|
| BLAKE2b-256 |
1d22f8e4a88c67de96967eee041b9c827fb2d0a0ed5ed1125c1babd392a40970
|
Provenance
The following attestation bundles were made for regenx-0.0.2.tar.gz:
Publisher:
ci.yaml on 0000matteo0000/regenx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
regenx-0.0.2.tar.gz -
Subject digest:
8161e49622fccec0d5a14cb6b2a19a4a2e176a4d832a38d5a904ef57d7945cbb - Sigstore transparency entry: 160618773
- Sigstore integration time:
-
Permalink:
0000matteo0000/regenx@88819a586523e9e2023131c15491da74f6248e45 -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/0000matteo0000
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yaml@88819a586523e9e2023131c15491da74f6248e45 -
Trigger Event:
release
-
Statement type:
File details
Details for the file regenx-0.0.2-py3-none-any.whl.
File metadata
- Download URL: regenx-0.0.2-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0e129e332884bda697b78e0ef0acaeb3c128c7df96fc4e4b3a931f31cfea50ad
|
|
| MD5 |
18c81506f03a5b3bc9967bd1f6d03f8c
|
|
| BLAKE2b-256 |
2c308236995bdfecf58c683c79918345aa75fcf4898aa204a3f505298e2eb645
|
Provenance
The following attestation bundles were made for regenx-0.0.2-py3-none-any.whl:
Publisher:
ci.yaml on 0000matteo0000/regenx
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
regenx-0.0.2-py3-none-any.whl -
Subject digest:
0e129e332884bda697b78e0ef0acaeb3c128c7df96fc4e4b3a931f31cfea50ad - Sigstore transparency entry: 160618776
- Sigstore integration time:
-
Permalink:
0000matteo0000/regenx@88819a586523e9e2023131c15491da74f6248e45 -
Branch / Tag:
refs/tags/0.0.2 - Owner: https://github.com/0000matteo0000
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yaml@88819a586523e9e2023131c15491da74f6248e45 -
Trigger Event:
release
-
Statement type: