You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

genrex

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

genrex

Genrex generates matching strings to a given regular expressions.

1.0.1
pipPyPI
Maintainers
1

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

  • support re flags (e.g. re.ASCII)

Alternatives

PackageLicense
exrexAGPL-3.0
rstrBSD

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts