Core Concepts
Equivalence and Subset
These operations compare two Terms by language and return a boolean.
Equivalent
Two Terms are equivalent when they match exactly the same set of strings, even if written differently.
Example:
RegexSolverClient client = RegexSolverClient.builder()
.apiToken(System.getenv("REGEXSOLVER_API_TOKEN"))
.build();
Term a = Term.regex("a(b|c)");
Term b = Term.regex("ab|ac");
boolean result = client.equivalent(a, b);
System.out.println(result); // true
Subset
A Term A is a subset of B if every string matched by A is also matched by B.
Example:
RegexSolverClient client = RegexSolverClient.builder()
.apiToken(System.getenv("REGEXSOLVER_API_TOKEN"))
.build();
Term a = Term.regex("cat|dog");
Term b = Term.regex("[a-z]+");
boolean r1 = client.subset(a, b);
System.out.println(r1); // true
boolean r2 = client.subset(b, a);
System.out.println(r2); // false
Last modified on