Building a regex without memorizing syntax
Regular expressions pack a lot of meaning into a few punctuation characters, and it's easy to forget whether \b means boundary or backspace, or whether {2,4} is inclusive on both ends. This tool lets you click the piece you want — a digit, a whitespace character, a capturing group, a whole email pattern — and it gets inserted at your cursor. Select some text first and click a group token to wrap that selection instead of replacing it.
Once you have something built, it's tested live against your sample text below using the browser's native RegExp engine, with matches and capture groups highlighted immediately. If you already have a pattern and just want to test or debug it, the Regex Tester is a more direct fit.
Tips
- Quantifiers (
*,+,?,{n,m}) apply to whatever comes immediately before them — insert the token or group first, then click the quantifier right after it. - A quantifier is greedy by default (matches as much as possible). Add the lazy
?token right after it to make it match as little as possible instead. - Named groups (
(?<name>...)) show up in the match results below asname="...", which is handy when a pattern has several capture groups and numbers alone get hard to track.
FAQ
Why does my pattern need the g flag?
Without g, JavaScript's RegExp stops at the first match. This tool always scans for every match when testing, regardless of whether g is checked, so you can see the full picture — but leave it on if you plan to copy the pattern into code that expects multiple matches.
Can I edit the pattern by hand?
Yes — the pattern field is a normal text input. The token buttons are a shortcut for building or extending a pattern, not the only way to edit it.
I'm trying to understand a pattern someone else wrote — is there a tool for that?
Yes — paste it into the Regex Visualizer to see it broken down into a diagram of groups, alternatives, and quantifiers with a plain-English explanation of each piece.
Is there a quick reference for all these tokens?
The Regex Cheat Sheet Generator lets you pick the sections you need and export them as Markdown or plain text to keep alongside your notes.
How do I know a pattern I built here is safe to use on real input?
Run it through the Regex Debugger — it flags risky nested-quantifier shapes before you ship them and shows exactly how a match attempt unfolds, step by step.