Skip to content
pubscout

randexp

0.0.1, released 5 years ago by an unverified publisher

Create random strings that match a given regular expression.

WASM-ready
$ flutter pub add randexp
Source repository

What it does

Generates random strings that match a given regular expression object in Dart. It supports grouping, piping, character sets, ranges, back-references, and custom PRNGs.

AI-written summary of version 0.0.1, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You need to generate random test data matching specific regex patterns.
  • You want to create mock strings for form inputs or validation testing.

Skip it when

  • You need to parse or validate regular expressions rather than generate strings from them.

Strengths

  • Supports a wide range of regex features like groups, piping, and back-references.
  • Allows custom PRNGs for seeded or cryptographic randomness.
  • Configurable maximum repetition for infinite repetitional tokens.

Weaknesses

  • Some badly placed positional or negated character sets cannot match anything and return empty strings.

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
2
import 'package:randexp/randexp.dart';

void main() {
  RandExp(RegExp(r'hello+ (world|to you)')).gen();
}

Alternatives

Packages that do the same job and could replace randexp.