Regex String Generator
Overview
Regex String Generator is a Python package that allows you to generate random strings that match a given regular expression pattern.
Features
Installation
Install the package using pip:
pip install regex-string-generator
Use Cases
Create random strings for various purposes such as database seeding, API testing, form validation, or any other scenario where you need controlled random data that adheres to specific formats.
- Testing: Generate test data that matches the input validation rules of your application. This ensures your application handles all expected input formats correctly.
- Validate Regex: Check the effectiveness of your regex patterns by generating matching strings. This helps you understand if your regex is too broad or too restrictive.
- Regex Learning Tool: For those learning regular expressions, this package provides a way to see examples of strings that match specific patterns, helping to reinforce understanding.
Usage Examples
Here's how you can use the generate_string function.
Example 1: Generate a simple username
from regex_string_generator import generate_string
username_pattern = r"[a-z]{8}" # 8 lowercase letters
username = generate_string(username_pattern)
print(f"Generated username: {username}")
# Output: Generated username: abcdefgh
Example 2: Generate a simple password
from regex_string_generator import generate_string
password_pattern = r"[A-Za-z0-9]{10}" # 10 alphanumeric characters
password = generate_string(password_pattern)
print(f"Generated password: {password}")
# Output: Generated password: Ab3d5Fg2h9
Example 3: Generate a simple hexadecimal color code
from regex_string_generator import generate_string
color_pattern = r"#[A-Fa-f0-9]{6}" # Hex color code
color = generate_string(color_pattern)
print(f"Generated color code: {color}")
# Output: Generated color code: #1A2B3C
Metadata
Release files for regex-string-generator 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| regex_string_generator-0.1.0.tar.gz | 6.6 kB | Without provenance | Details for regex_string_generator-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| regex_string_generator-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for regex_string_generator-0.1.0-py3-none-any.whl |
Total release size: 13.5 kB
Release files / regex_string_generator-0.1.0.tar.gz
| Download URL | regex_string_generator-0.1.0.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
cec7b1951a8a0286829a566fd8b469f17b552ccb4777e07a7081cddacceca7b8
|
|
BLAKE2b-256 checksum How to use checksums |
fad1c3d32bd6241dfe931009718f20ede216e064c70a5992a276162309f87cda
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Release files / regex_string_generator-0.1.0-py3-none-any.whl
| Download URL | regex_string_generator-0.1.0-py3-none-any.whl |
|---|---|
| Size | 6.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0bdc8b5330b0ef7edab06f998e2dbb69f740629b2cee6cb9ff3df0acb3f1f2da
|
|
BLAKE2b-256 checksum How to use checksums |
aa31f17cd3071df156708e9268d14270db3dd9c6f539aa276d1353e0a9854680
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.12.4
|
Security for regex-string-generator 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.