grex is a regular expression generator that creates regex patterns from user-provided test cases. It implements DFA construction, Hopcroft's minimization algorithm, and Brzozowski's algebraic method to produce Perl-compatible regexes. The system serves dual purposes as a command-line utility and a library with bindings for Rust, Python, and WebAssembly. Key features include Unicode grapheme handling, configurable character class conversions (digits/whitespace/word), case insensitivity, repetition detection, and syntax highlighting. The architecture separates core regex building logic from CLI, Python, and WASM extension points, enabling reuse across multiple contexts.
python-hyperscan is a CPython extension providing Python bindings for Vectorscan (a fork of Intel's Hyperscan), a high-performance multiple regex matching library. The library enables efficient pattern matching with statically linked binaries and cross-platform support. It exposes most of the Hyperscan C API through Python classes including Database for pattern compilation, Scan for text scanning, Stream for streaming processing, and Scratch for thread-safe scratch space management. The implementation features proper buffer protocol support, sophisticated GIL handling for both traditional and free-threaded Python models, and careful resource management. The build system uses scikit-build-core with CMake to statically link Hyperscan/Vectorscan along with dependencies like PCRE and Boost, producing binary wheels for multiple platforms.