DevTools Hub

Search tools

Search for a developer tool

Development

Regex Builder

Build a JavaScript regular expression visually by clicking pattern pieces.

Character classes
Anchors & boundaries
Quantifiers
{,}
Groups & alternation
(?<>)
Common presets
//g

Click a token above to insert it at the cursor, or select text first and click a group token to wrap it. You can also type directly in this field.

2 matches
Order #1024 shipped, order #205 is pending.
Matches & groups
  • [7] "1024"
  • [28] "205"

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

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.

Related tools