# AI Regex Generator

> Describe what to match and an on-device AI writes a regular expression, tests it against your sample with a real regex engine and fixes it before answering.

- URL: https://www.tooljig.com/ai-regex-generator
- Category: [On-device AI](https://www.tooljig.com/category/ai.md)
- Runs: On-device AI in the browser (WebGPU or WebAssembly); nothing uploaded
- Price: free, no account needed

## What it does

Regex from a description, verified: the model proposes a JavaScript pattern, runs it on your sample text through the same engine as the Regex Tester, reads the matches and corrects the pattern if they are wrong. You see each attempt as a tool call, so you know the final pattern was actually tested. The model runs inside your browser tab. Its weights download once from Hugging Face and can stay on your device; your text and files are never uploaded.

## How to use it

1. Paste sample text the pattern must work on.
2. Describe what to match.
3. Watch the test runs, then copy the final pattern.

## Good to know

- Patterns are JavaScript (ECMAScript) syntax.
- Test the result on more data in the Regex Tester before relying on it.

## FAQ

### Is my data sent to a server or to an AI company?

No. Inference runs locally with ONNX Runtime in your browser. The only network traffic is the one-time model download from Hugging Face; nothing you type or open is transmitted.

### How big is the download, and does it happen every time?

The first run downloads the model once (about 250–600 MB depending on the model; the exact size is shown before you start). It is kept in your browser's storage by default, so later visits load it in seconds and work offline. You can turn that off or delete stored models on the model manager page.

## Related tools

- [Regex Tester](https://www.tooljig.com/regex-tester.md): Test JavaScript regular expressions against sample text with live matches, capture groups and flags. Protected against runaway patterns.
- [On-device AI Chat](https://www.tooljig.com/ai-chat.md): Chat with a small open AI model running entirely in your browser. No account, no API key, nothing uploaded. Exact maths and conversions through built-in tools.
- [Find and Replace](https://www.tooljig.com/find-and-replace.md): Find and replace text online with plain text or regular expressions. Match case, whole words, $1 backreferences, a live match count and preview.
