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
    Term's FormatUnion, Intersection, Difference and ComplementConcatenation and RepetitionEquivalence and SubsetAnalyzing a TermGenerate Strings
Guides
Advanced Usage
API Reference
Core Concepts

Union, Intersection, Difference and Complement

These operations build a new Term from existing ones using classic set operations. They are the core of the API, and every result is a Term you can pass to the next call.

Union

Returns a Term representing strings that appear in any of the provided Terms (logical OR).

Example:

Code
RegexSolverClient client = RegexSolverClient.builder() .apiToken(System.getenv("REGEXSOLVER_API_TOKEN")) .build(); Term a = Term.regex("abe"); Term b = Term.regex("cde"); Term c = Term.regex("efe"); OperationOptions options = OperationOptions.builder() .responseFormat(ResponseFormat.REGEX); Term result = client.union(List.of(a, b, c), options); System.out.println(result); // regex=(ab|cd|ef)e

Intersection

Returns a Term representing only strings that appear in all of the provided Terms (logical AND).

Example:

Code
RegexSolverClient client = RegexSolverClient.builder() .apiToken(System.getenv("REGEXSOLVER_API_TOKEN")) .build(); Term a = Term.regex("[a-z]{2}"); Term b = Term.regex("(ab|cd|efg)"); Term c = Term.regex("a.*"); OperationOptions options = OperationOptions.builder() .responseFormat(ResponseFormat.REGEX); Term result = client.intersection(List.of(a, b, c), options); System.out.println(result); // regex=ab

Difference

Returns a Term representing strings that are in the first Term but not in the second one.

Example:

Code
RegexSolverClient client = RegexSolverClient.builder() .apiToken(System.getenv("REGEXSOLVER_API_TOKEN")) .build(); Term a = Term.regex("(cat|dog|owl)"); Term b = Term.regex("dog"); OperationOptions options = OperationOptions.builder() .responseFormat(ResponseFormat.REGEX); Term result = client.difference(a, b, options); System.out.println(result); // regex=(cat|owl)

Complement

Returns a Term representing every string that is not in the given Term's language.

Example:

Code
RegexSolverClient client = RegexSolverClient.builder() .apiToken(System.getenv("REGEXSOLVER_API_TOKEN")) .build(); Term term = Term.regex(".*a.*"); OperationOptions options = OperationOptions.builder() .responseFormat(ResponseFormat.REGEX); Term result = client.complement(term, options); System.out.println(result); // regex=[^a]*
Last modified on August 8, 2026
Term's FormatConcatenation and Repetition
On this page
  • Union
  • Intersection
  • Difference
  • Complement
Java
Java
Java
Java