Regex Builder & Tester

Build, test and debug regular expressions with live match highlighting.

Ad placeholder (leaderboard)
Enjoying the tools? Go Pro for £4.99 (one-time) and remove all ads — forever, on this device. Remove ads — £4.99

A complete regex builder and tester that turns regular-expression work into a fast, visual workspace. Instead of editing a pattern blind and re-running your code to see whether it matched, you type the pattern here and watch every match highlight live across your test text, with a full breakdown of each capture group in a sortable table. It is built for developers writing validation rules, log parsers, search-and-replace scripts and data-cleaning pipelines — and for anyone learning regex who wants instant, honest feedback on what their pattern actually does.

How it works

The tool wraps your pattern and flags in the browser’s native JavaScript RegExp engine — the exact engine your code will run in production, so there are no surprises between the tester and your app. As you type, three things update at once: the highlight pane paints each match in alternating colours so adjacent and overlapping matches stay readable; the capture-group table lists every match with its character range, full text and the value of each numbered ($1, $2) and named (<year>) group; and an optional replace panel previews a find-and-replace using $1 / $<name> back-references before you commit it.

A library of common-pattern presets — email, URL, IPv4, ISO date, UK postcode, hex colour, international phone, kebab-case slug, duplicate words and quoted strings — loads a working pattern and a matching sample so you can see the technique immediately and adapt it. Toggle the six flags (g, i, m, s, u, y) with one click each; hover a flag for a plain-English reminder of what it does. The engine guards against the classic zero-length-match infinite loop (/a*/g) and caps runaway scans so a greedy pattern on a huge string never freezes your tab. Your current pattern, flags and test string are quietly saved to this browser’s local storage, so closing the tab and coming back later restores your whole session.

Example

Suppose you need to pull the year, month and day out of dates in a log file. Load the Date (YYYY-MM-DD) preset, which sets the pattern (\d{4})-(\d{2})-(\d{2}) with the g flag, then paste your log lines into the test box. Each date lights up in the highlight pane, and the capture table shows one row per date with $1 = year, $2 = month and $3 = day:

#Match$1$2$3
12026-05-3020260530
22026-06-1520260615
32026-12-0120261201

Open the Replace panel and type $3/$2/$1 to instantly preview every date rewritten into UK DD/MM/YYYY format. Copy the finished /pattern/flags literal with one button and drop it straight into your JavaScript, TypeScript or Node code. Everything is computed in your browser — no pattern or test data ever leaves the page.

Ad placeholder (rectangle)