RegexSolverRegexSolver
  • Live Demo
  • Docs
  • Pricing
  • Open Source ↗
  • Console ↗
Console ↗
  • Docs
  • API Reference
HELP
  • Documentation
  • Report an issue ↗
RESOURCES
  • Developer console
  • GitHub ↗
LEGAL
  • Privacy policy
  • Terms & conditions
RegexSolverRegexSolver

© 2026 REGEXSOLVER · ALL RIGHTS RESERVED

QuickstartAll OperationsSync and Async ClientsPlans and Pricing
Core Concepts
Guides
Advanced Usage
    DeterminismString Generation OrderingBounding ExecutionHeavy OperationsAuto-Batching
API Reference
Advanced Usage

String Generation Ordering

String generation returns the strings a Term matches in a fixed order. The options on this page change which of them come first.

Every example uses the same pattern: (alpha|beta|prod)-[a-z0-9]{4}.

Path order

A path is one of the shapes the Term allows, as opposed to the characters filling it. beta-____ and prod-____ are two different paths through the same language. pathOrder decides the order in which paths are scheduled:

  • sweep (default): expand one path in full, shortest first, before moving to the next one. The cheapest way to page through a whole language with offset.
  • interleave: cover every path the Term holds before any path is asked for a second string. Slower than sweep, but better suited to deriving test cases from a small limit.
  • shuffled: interleave with same-length paths visited in an order drawn by the seed. Shorter paths still come first, so the seed only draws among paths of equal length.
Code
Term term = Term.regex("(alpha|beta|prod)-[a-z0-9]{4}"); GenerateStringsOptions options = GenerateStringsOptions.builder() .pathOrder(PathOrder.INTERLEAVE); List<String> results = client.generateStrings(term, 5, 0, options); System.out.println(results); // ["beta-0000", "prod-0000", "alpha-0000", "beta-0001", "beta-0002"] // sweep would have stayed on one path: ["beta-0000", "beta-0001", ...]

Character order

characterOrder decides which strings within each path come first:

  • ascending (default): fill each position from the low end of its character range, giving 0000, 0001 and so on.
  • shuffled: use a permutation drawn from the seed, so the strings look like real data while staying reproducible.
Code
Term term = Term.regex("(alpha|beta|prod)-[a-z0-9]{4}"); GenerateStringsOptions options = GenerateStringsOptions.builder() .characterOrder(CharacterOrder.SHUFFLED); List<String> results = client.generateStrings(term, 5, 0, options); System.out.println(results); // ["beta-xzxy", "beta-91fx", "beta-e80i", "beta-f8yb", "beta-wg6k"]

Seeds and reproducibility

The shuffled modes are not random. The seed has a fixed default, so two calls sharing a seed generate exactly the same strings, and offset pages through them without repeats or gaps. Change the seed to draw a different sequence from the same Term.

The seed is ignored unless a shuffled mode is in use, and the exact sequence a given seed produces may change between releases.

Code
Term term = Term.regex("(alpha|beta|prod)-[a-z0-9]{4}"); GenerateStringsOptions options = GenerateStringsOptions.builder() .pathOrder(PathOrder.SHUFFLED) .characterOrder(CharacterOrder.SHUFFLED) .seed(42L); System.out.println(client.generateStrings(term, 5, 0, options)); // ["beta-akge", "prod-pc2a", "alpha-h3ro", "beta-greu", "beta-uoal"] // The same seed on the next page continues the sequence: System.out.println(client.generateStrings(term, 5, 5, options)); // ["prod-g0sd", "prod-ib77", "alpha-mvhn", "alpha-mhi1", "beta-9evq"]

A seed makes the ordering reproducible. Consistent pagination across calls still requires the Term itself to be deterministic. See Determinism.

Realistic test data

Combining the three options gives diverse, natural-looking, reproducible fixtures: interleave the paths so every shape appears once, shuffle the characters so nothing looks like a counter, and fix the seed so your test suite sees the same data every run.

Code
Term term = Term.regex("(alpha|beta|prod)-[a-z0-9]{4}"); GenerateStringsOptions options = GenerateStringsOptions.builder() .pathOrder(PathOrder.INTERLEAVE) .characterOrder(CharacterOrder.SHUFFLED) .seed(7L); List<String> fixtures = client.generateStrings(term, 6, 0, options); System.out.println(fixtures); // ["beta-jti3", "prod-4dcf", "alpha-51cl", "beta-2kal", "beta-2w1i", "prod-oizr"]

Try the orderings interactively in the live demo.

Last modified on August 8, 2026
DeterminismBounding Execution
On this page
  • Path order
  • Character order
  • Seeds and reproducibility
  • Realistic test data
Java
Java
Java
Java