Demo

Runs in your browser, on regexsolver compiled to WebAssembly: nothing is sent anywhere. A result can be shown as its automaton, or as a pattern by state elimination or by a neural synthesis model, downloaded from Hugging Face on first use. The address bar keeps the inputs, so a demo can be shared by its link.

The strings both patterns match, as one pattern.

A learned model proposes a simpler pattern, checked against the automaton. Downloads 21 MB on first use.

RESULT
› THE SAME CALL IN RUST
use regexsolver::Term;
use regexsolver::neural_synthesis::{Device, NeuralSynthesizer};

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let a: Term = "/api/v[12]/.*".parse()?;
    let b: Term = ".*/users/[0-9]+".parse()?;

    let result = a.intersection([&b])?;

    let synthesizer = NeuralSynthesizer::from_hub(
        "alexvbrdn/kleene2-5m-b16-t128",
        Device::best_available(),
    )?;
    println!("{}", result.to_pattern_with(&synthesizer)?);
    Ok(())
}
REGEXSOLVER 1.3.1