Skip to main content

yet another regex based text generation library

Project description

regenx

regenx is yet another regex based text generation library

PyPI - Version PyPI - Python Version


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

  • \d digits, same as [0-9]
  • \D non digits, same as [^0-9]
  • \s whitespace, same as [ \t\n\r\f\v]
  • \S non whitespace, same as [^ \t\n\r\f\v]
  • \w same as [a-zA-Z0-9_]
  • \W same as [^a-zA-Z0-9_]
  • \a ascii bell (BEL)
  • \b ascii backspace (BS)
  • \f ascii formfeed (FF)
  • \n ascii linefeed (LF)
  • \r ascii carriage return (CR)
  • \t ascii horizontal tab (TAB)
  • \v ascii vertical tab (VT)

numerical escape sequences:
the positive integer number given will be converted to the associated character

  • \o octal escape sequence, note: must be 3 digits long, this is different to the standard \<octal_number> to distinguish it from back references
  • \x 8bit hexadecimal escape sequence, note: must be 2 digits long
  • \u 16bit hexadecimal escape sequence, note: must be 4 digits long
  • \U 32bit 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

regenx-0.0.2.tar.gz (11.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

regenx-0.0.2-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

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

Hashes for regenx-0.0.2.tar.gz
Algorithm Hash digest
SHA256 8161e49622fccec0d5a14cb6b2a19a4a2e176a4d832a38d5a904ef57d7945cbb
MD5 3dd3c2cdff2bcee4b8d58b8528972cee
BLAKE2b-256 1d22f8e4a88c67de96967eee041b9c827fb2d0a0ed5ed1125c1babd392a40970

See more details on using hashes here.

Provenance

The following attestation bundles were made for regenx-0.0.2.tar.gz:

Publisher: ci.yaml on 0000matteo0000/regenx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for regenx-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0e129e332884bda697b78e0ef0acaeb3c128c7df96fc4e4b3a931f31cfea50ad
MD5 18c81506f03a5b3bc9967bd1f6d03f8c
BLAKE2b-256 2c308236995bdfecf58c683c79918345aa75fcf4898aa204a3f505298e2eb645

See more details on using hashes here.

Provenance

The following attestation bundles were made for regenx-0.0.2-py3-none-any.whl:

Publisher: ci.yaml on 0000matteo0000/regenx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page