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 hashes)

Uploaded Source

Built Distribution

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

Uploaded Python 3

Supported by

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