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
- support re flags (e.g.
re.ASCII
)
Alternatives
Package | License |
---|---|
exrex | AGPL-3.0 |
rstr | BSD |
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
genrex-0.1.tar.gz
(5.9 kB
view hashes)
Built Distribution
genrex-0.1-py3-none-any.whl
(5.3 kB
view hashes)