Loading…
regexgen is a JavaScript library that generates regular expressions designed to match a specified set of strings, offering both a simple API and a CLI. It builds a Trie from the input strings, minimizes the resulting DFA with Hopcroft's algorithm, and converts the DFA to a regex via Brzozowski's algebraic method, producing a RegExp object (default JS regex with UCS-2 surrogates or, with -u, an ES2015 Unicode regex). It can be used by passing an array of strings to regexgen or by using the Trie class directly, and it is licensed under MIT.
AI named regexgen in December 2025.