Hand-written fixtures rot the moment the pattern changes. Generate the strings from the pattern itself: distinct, deterministic, paginated. Test data and validator can never disagree.
Each card calls the real API. Edit the patterns and compute. No signup.
| Operation | Notation | Answers | Returns |
|---|---|---|---|
| strings | {s ∈ A} | Distinct strings the pattern matches, paginated by limit/offset. | string[] |
| Parameter | Values | Meaning |
|---|---|---|
| limit | 1 to 100 | Maximum number of distinct strings to return in the call. The example cards above and the live demo cap it at 10. |
| offset | integer | Strings to skip before collecting, which is how you paginate. |
| minLength | integer | Lower bound of the length window; excluded strings never consume offset positions. |
| maxLength | integer | Upper bound of the length window. |
| pathOrder | sweep · interleave · shuffled | Which paths of the language are expanded first. |
| characterOrder | ascending · shuffled | How each position is filled from its character range. |
| seed | integer | Draws both shuffled orders, so a shuffled run stays reproducible. |
| charset | character class | Restricts generation to a character class such as [a-z]; paths needing anything else are dropped. |
Every operation on this page, called through the official SDK.
import { RegexSolverClient, Term } from 'regexsolver';
const client = new RegexSolverClient({ apiToken: 'REGEXSOLVER_API_TOKEN' });
const term = Term.regex("(alpha|beta|prod)-[a-z0-9]{4}");
// Distinct fixtures straight from the format you already wrote
await client.generateStrings(term, 5, 0);
// ["beta-0000", "beta-0001", "beta-0002", "beta-0003", "beta-0004"]
// Offset pages through the language, no repeats, no gaps. Offsets only line up
// from page to page on a deterministic term, and a term built from a pattern
// isn't one, so determinize it once before the first page.
const bits = await client.determinize(Term.regex("[01]{3}"));
const all = [];
for (let offset = 0; ; offset += 3) {
const page = await client.generateStrings(bits, 3, offset);
all.push(...page);
if (page.length < 3) break;
}
// ["000", "001", "010"], then ["011", "100", "101"], then ["110", "111"]
// Only strings inside a length window; excluded ones never consume offset
await client.generateStrings(Term.regex("(ab|cde)*"), 5, 0, { minLength: 4, maxLength: 6 });
// ["abab", "cdeab", "abcde", "ababab", "cdecde"]
// Keep output printable when the pattern allows all of Unicode
await client.generateStrings(Term.regex("[a-z]{3}"), 5, 0, { charset: "[a-c]" });
// Realistic-looking data, still reproducible: same seed, same strings
await client.generateStrings(term, 5, 0, {
pathOrder: "shuffled", characterOrder: "shuffled", seed: 42,
});