Skip to main content

Genrex generates matching strings to a given regular expressions.

Project description

Genrex

Genrex generates matching strings to a given regular expressions.

Usecases

  • generate test data
  • calculate the cardinality of a regular expression.

Quickstart

Requirements

  • Pyhton 3.x

Install

pip install genrex

First Steps

import genrex

emails = genrex.parse(r'(John|Jane)\.(Doe|Smith)@(gmail|outlook|protonmail)\.com')

print('random email address: ', emails.random())
print('first email address: ', emails[0])
print('number of email addresses: ', len(emails))

print('')
[print(email) for email in emails] #print all emails

Output:

random email address:  Jane.Doe@gmail.com
first email address:  John.Doe@gmail.com
number of email addresses:  12

John.Doe@gmail.com
Jane.Doe@gmail.com
John.Smith@gmail.com
Jane.Smith@gmail.com
John.Doe@outlook.com
Jane.Doe@outlook.com
John.Smith@outlook.com
Jane.Smith@outlook.com
John.Doe@protonmail.com
Jane.Doe@protonmail.com
John.Smith@protonmail.com
Jane.Smith@protonmail.com

Features

Supported Regular Expression Syntax

  • .
  • *
  • +
  • ?
  • {m}
  • {m,n}
  • | - Branch
  • [...] - Set
  • (...) - Group
  • \d, \s, ... - Categories

TODO

Alternatives

Package License
exrex AGPL-3.0
rstr BSD

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

genrex-1.0.1.tar.gz (4.2 kB view details)

Uploaded Source

Built Distribution

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

genrex-1.0.1-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file genrex-1.0.1.tar.gz.

File metadata

  • Download URL: genrex-1.0.1.tar.gz
  • Upload date:
  • Size: 4.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for genrex-1.0.1.tar.gz
Algorithm Hash digest
SHA256 aa5c27cc8ccc8e9f2ce28eeba6fa58db84ff5d3704d52328ac28be57effc0c67
MD5 4b4f5ee7a057357d251432ad46a18bb7
BLAKE2b-256 882100b7dea13d0ce1876a39dda8737cd902db3ecf7791852e8944965ab9e22e

See more details on using hashes here.

File details

Details for the file genrex-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: genrex-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.1 requests/2.25.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.8.6

File hashes

Hashes for genrex-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 95a2dd2c797448a9c38bb8a59515ba03abfae1caa060a7f182778cc5533a7568
MD5 070b6b4957fe24b8faa2e963058d1d58
BLAKE2b-256 54b883ea9252b058c19b202c8846b01073a7e4d8fafc080e9fa75073f207be0e

See more details on using hashes here.

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