Prove every regex change.

A test suite samples a few strings; the automaton checks them all. Prove two patterns equivalent, prove a rewrite only tightens, count and bound every possible match. Exact answers, one call.

Run it on your patterns.

Each card calls the real API. Edit the patterns and compute. No signup.

Same rule, written two ways?OPEN IN LIVE DEMO →
A =
B =
A B
BOOLEANtrue
Did the refactor make the validator stricter?OPEN IN LIVE DEMO →
A =
B =
A B
BOOLEANtrue
How many strings can it match?OPEN IN LIVE DEMO →
A =
|A|
COUNT1048576
Shortest and longest possible match?OPEN IN LIVE DEMO →
A =
len(A)
RANGE[9, 10]
OperationNotationAnswersReturns
cardinality|A|How many distinct strings does the pattern match?count | ∞
lengthlen(A)Shortest and longest possible match.[min, max]
empty / totalA = ∅ · A = Σ*Matches nothing at all? Matches everything?boolean
equivalentABSame language, regardless of syntax?boolean
subsetABIs every match of A also a match of B?boolean
patternre(A)A compact, human-readable regex for any term.regex
empty_stringA = {ε}Matches only the empty string?boolean
deterministicdet(A)Is the automaton deterministic? A stable string order requires it.boolean
dotdot(A)The automaton as a Graphviz DOT graph, ready to render.dot

The whole group, in code.

Every operation above through the official client. The API is plain REST underneath, so any HTTP client works too.

import { RegexSolverClient, Term } from 'regexsolver';

const client = new RegexSolverClient({ apiToken: 'REGEXSOLVER_API_TOKEN' });

// Same rule, written two ways?
await client.equivalent(Term.regex("(abcd|abef)"), Term.regex("ab(cd|ef)"));
// true

// Did the refactor make the validator stricter? New matches must all be old matches.
await client.subset(Term.regex("beta-[0-9]{4}"), Term.regex("(alpha|beta)-[0-9]{4}"));
// true

// Exact size of the language, not a sample
await client.getCardinality(Term.regex("[a-f0-9]{5}"));
// 1048576

// Shortest and longest possible match
await client.getLength(Term.regex("(alpha|beta|prod)-[a-z0-9]{4}"));
// [9, 10]

// Prove two rules identical: their difference must be empty
const gap = await client.difference(Term.regex("(abcd|abef)"), Term.regex("ab(cd|ef)"));
await client.isEmpty(gap);
// true