Try other tools
View allLong-form guide
Build regex visually, test live, or describe it in plain English
Regex Builder is the regex tool that wants you to never read another regex tutorial. Three modes share one editor: build patterns visually with drag-and-drop blocks, describe what you want in plain English and let the AI generate it, or paste an existing pattern and watch matches highlight live as you tweak the test string.
How to use it
- Pick a flavor. JavaScript, PCRE, Python, Ruby, or Go. The flavor selector at the top affects how the AI generates patterns and how flags are displayed. The visual builder always produces JS-compatible patterns, since those translate cleanly to every other flavor.
- Build visually. Use the block builder to compose patterns. Drag blocks into order — Anchor, Charset, Group, Repeat, Alternation, Literal — and the assembled pattern updates above. Each block is editable: click a Charset to set its contents, click a Repeat to set min and max, etc.
- Or generate with AI. Switch to the AI tab. Type a description like "match an IPv4 address but not localhost" and click Generate. The AI returns a regex, an explanation of what each part means, and three example test cases. You get five AI requests per day — earn ten more by watching a rewarded ad.
- Test live. The bottom panel takes a test string and highlights matches in real time. Edit the string or the regex and the highlights update immediately. Hover any match to see its capture groups and start/end indices.
- Copy, export, or share. Copy the regex literal (with delimiters) for quick paste. Download the test file to get a generated Jest or Mocha spec with the AI's test cases. Share to generate a permalink that round-trips both the pattern and the test string.
What's behind each mode
The visual builder is purely client-side. Each block compiles to a fragment of regex syntax; the panel concatenates fragments into the final pattern. This is the right mode for "I know what I want, I just want it composable" — like dragging Lego bricks instead of memorizing escape rules.
The AI mode calls Groq first (using a small, fast model) and falls back to a free OpenRouter model when Groq quotas are tight. Your prompt and the resulting regex are never persisted; they're held in memory long enough to render the response and then discarded. We rate-limit by IP plus a fingerprint to make abuse expensive and the free tier sustainable.
The test panel uses your browser's native regex engine for JavaScript flavor and a small WASM-compatible engine for the others, so what you see is exactly what you'll get when you paste the pattern into your code. Capture groups, named groups, lookaheads, and lookbehinds are all supported in the flavors that allow them.
When to reach for it
Most teams don't write regex daily, so they forget the syntax. The builder lets a senior reviewer skim a visual diagram of the pattern instead of decoding (?:[^\s\\]|\\.)*?. The AI mode helps when you know what you want but can't remember whether \b is a word boundary or backspace. The live tester is a sanity check before shipping a pattern that decides whether emails are valid.
A common workflow: describe the pattern in English, let AI generate it, switch to the visual builder to inspect block-by-block, paste a few real test strings into the test panel to confirm matches, then download the test file and commit both regex and tests at once.
Regex Builder — это regex-инструмент, который хочет, чтобы ты больше никогда не читал туториалы по regex. Три режима в одном редакторе: собирай паттерны визуально drag-and-drop блоками, опиши что нужно простыми словами и пусть AI сгенерирует, или вставь существующий паттерн и смотри подсветку совпадений вживую, пока подкручиваешь тестовую строку.
Как использовать
- Выбери flavor. JavaScript, PCRE, Python, Ruby или Go. Селектор сверху влияет на то, как AI генерирует паттерны и как отображаются флаги. Визуальный конструктор всегда даёт JS-совместимые паттерны, потому что они чисто транслируются в любой другой синтаксис.
- Собирай визуально. Block builder для композиции паттернов. Перетаскивай блоки в порядке — Anchor, Charset, Group, Repeat, Alternation, Literal — собранный паттерн обновляется сверху. Каждый блок редактируем: кликни Charset, чтобы задать содержимое, Repeat — чтобы задать min/max и т.д.
- Или сгенерируй через AI. Переключись на вкладку AI. Введи описание вроде «найди IPv4-адрес, но не localhost» и нажми Generate. AI вернёт regex, объяснение каждой части и три примера тест-кейсов. У тебя 5 AI-запросов в день — посмотри rewarded-рекламу, чтобы получить +10.
- Тестируй вживую. Нижняя панель берёт тестовую строку и подсвечивает совпадения в реальном времени. Меняешь строку или regex — подсветка обновляется. Наведи на совпадение, чтобы увидеть capture-группы и индексы start/end.
- Скопируй, экспортируй или поделись. Копируй regex-литерал (с разделителями) для вставки. Download test file даёт сгенерированный Jest или Mocha файл с тест-кейсами от AI. Share создаёт постоянную ссылку, в которой пакется и паттерн, и тестовая строка.
Что под капотом каждого режима
Визуальный конструктор — целиком на клиенте. Каждый блок компилируется во фрагмент regex-синтаксиса; панель собирает фрагменты в финальный паттерн. Этот режим — для «знаю, что хочу, нужна композиция» — как Lego-кубики вместо запоминания escape-правил.
AI-режим сначала зовёт Groq (маленькой быстрой моделью), и фолбэчится на бесплатную модель OpenRouter, когда квоты Groq на исходе. Твой промпт и результат regex нигде не сохраняются — держатся в памяти ровно столько, чтобы отрисовать ответ, и сразу отбрасываются. Лимит — по IP плюс fingerprint, чтобы абьюз был дорогим, а бесплатный тир — устойчивым.
Тест-панель использует нативный regex-движок браузера для JavaScript flavor и маленький WASM-совместимый для остальных, так что то, что видишь, и есть то, что получишь, когда вставишь паттерн в код. Capture-группы, именованные группы, lookahead и lookbehind поддерживаются в тех flavor, где они разрешены.
Когда это пригодится
Большинство команд не пишут regex каждый день и забывают синтаксис. Конструктор позволяет старшему ревьюеру пробежаться по визуальной диаграмме паттерна вместо декодирования (?:[^\s\\]|\\.)*?. AI-режим помогает, когда знаешь, что нужно, но забыл, \b — это word boundary или backspace. Live-тестер — sanity-чек перед отправкой паттерна, который решает, валиден ли email.
Типичный workflow: описал паттерн на русском, AI сгенерировал, переключился на визуальный конструктор для пошагового разбора, вставил в тест-панель пару реальных строк и убедился, что совпадает, скачал тест-файл и закоммитил regex плюс тесты сразу.
Examples
match a valid email address with optional + subaddress
/^[a-zA-Z0-9._%+\-]+@[a-zA-Z0-9.\-]+\.[a-zA-Z]{2,}$/
// Test cases:
// '[email protected]' → match
// '[email protected]' → match
// '[email protected]' → no matchAnchor (^)
Literal (+1?)
Charset [0-9]
Repeat {3}
Literal (-)
Charset [0-9]
Repeat {3}
Literal (-)
Charset [0-9]
Repeat {4}
Anchor ($)/^\+1?[0-9]{3}-[0-9]{3}-[0-9]{4}$/find ISO 8601 dates (YYYY-MM-DD) anywhere in a text
/(?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})/g
// Test cases:
// 'Today is 2026-05-10.' → match: 2026-05-10
// 'Date: 26-05-10.' → no match