Projects

RegexForge — Plain English to a Regex You Can Trust

Active
Next.jsReactframer-motionOllama (qwen2.5:14b)OpenAI-compatible API
Product demo

Problem

Regex is not hard because the syntax is exotic. It is hard because you can never be sure the pattern does what you think — research on regex use names trust, test coverage, and cross-language portability as the real pains. Most AI regex generators print a pattern and wish you luck.

Business Impact

A wrong regex in a validator or a log parser fails quietly and in production. Shipping the pattern together with generated counter-examples turns a guess into something a reviewer can check in seconds.

System Approach

  • Plain-English prompt to candidate pattern via any OpenAI-compatible endpoint
  • Live tester highlights matches in pasted text as you type
  • Auto-generated positive and negative test cases evaluated continuously against the pattern
  • Token-by-token breakdown explaining every part of the expression
  • Export to JavaScript, Python, Go, Java, PHP, and Rust
  • Local-first config via Ollama; hosted providers are an env-var change

Key Decisions & Trade-offs

  • Prove, do not assert — generated counter-examples are the product, the pattern is the easy part
  • Negative cases as first-class as positive ones, since too-loose regexes are the common failure
  • Local LLM by default; sample text in a regex tester is often production data
  • Six-language export because half of regex users worry a pattern behaves differently across runtimes
  • OpenAI-compatible interface rather than a provider SDK, so any endpoint works unchanged

Current Status

Public and open source at github.com/rohitguta2432/regexforge. Generation, live tester, auto test cases, token breakdown, and six-language export all working; runs free and fully local against Ollama.

Roadmap

  • Per-flavour validation so an exported pattern is checked against that language's engine
  • Catastrophic-backtracking warnings on risky patterns
  • Save and share a forged pattern with its test suite

What I'd Improve Next

  • A hosted try-it instance for people without a local model
  • Import an existing regex and generate tests for it rather than starting from English

Explore More