Regex Tester Online
Test regular expressions with live highlighting, capture groups, flags and replace preview. Private by design: everything runs in your browser.
Matches highlight in yellow as you type. The caret stays visible while editing.
Match list
- #1
hello@toolsofweb.comat 14–34$1 = hello$2 = toolsofweb.com - #2
support@example.orgat 38–57$1 = support$2 = example.org
Related guide
Read guide: regex tester (flags, capture groups, debugging patterns) →
Test regular expressions (free, no signup)
Regular expressions are powerful but unforgiving — one misplaced bracket and the pattern silently matches nothing, or worse, matches the wrong things and you only find out in production. This free regex tester shows you exactly what your pattern does, live: matches light up inside your test text as you type, the match list breaks out every capture group with its character position, and invalid patterns get the engine's exact error message instead of a silent failure.
It runs JavaScript's RegExp engine — the same one in your browser and Node.js — so there is no flavor surprise when you copy the pattern into code. Six flag toggles sit above the test box: g (find all matches, not just the first), i (ignore case), m (let ^ and $ match line boundaries), s (let . match newlines too), u (full Unicode mode), and y (sticky — match only from the current position). Flip any of them and watch the highlights change in real time.
Two modes: match and replace
Match mode is for building and debugging: type a pattern, type test text, and inspect every match with its capture groups. Replace mode adds a replacement field and a live preview of the result, with support for back-references — $1, $2 for capture groups and $& for the whole match. It is the safe way to rehearse a find-and-replace before running it across real files: for example, pattern (\d4)-(\d2)-(\d2) with replacement $3/$2/$1 flips ISO dates to day/month/year while you watch.
A 5-minute regex survival kit
You do not need to memorize the whole syntax — these cover most real tasks. Try each in the tester to see it work:
- \d+ — one or more digits. The classic “find the numbers” pattern.
- \b\w+@\w+\.\w+\b — a rough email shape (fine for finding candidates in text; do not use it as strict validation).
- ^…$ — anchors. Without the m flag they mean start/end of the whole text; with it, start/end of each line.
- (a|b) — alternation: match “a” or “b”. Parentheses also create the capture groups shown in the match list.
- .*? — lazy match: as few characters as possible. The difference between greedy .* and lazy .*? is the single most common regex bug.
Debugging checklist when nothing matches
- Read the error first. Unbalanced brackets and parentheses are the top cause; the tester shows JavaScript's exact message.
- Check the flags. Case mismatch? You need i. Pattern spans lines? You need s for . to cross newlines, or m for per-line anchors.
- Suspect greediness. If a match swallows far more than expected, make the quantifier lazy with ?.
- Escape the literals. Dots, brackets, and parentheses in the text you are searching for must be backslash-escaped in the pattern.
- Simplify and rebuild. Delete half the pattern; when matches return, the bug is in the half you removed.
Flavor honesty: what transfers and what does not
Core syntax — character classes, quantifiers, groups, anchors — transfers directly to Python, Java, PHP, and most other languages. The differences live at the edges: Python uses (?P<name>…) for named groups where JavaScript uses (?<name>…), lookbehind support varies, and the s (dotall) flag is spelled re.DOTALL in Python. Build the logic here, then glance at your target language's docs for the handful of spellings that differ.
Your patterns never leave the tab
People test regexes against production logs, customer data, and proprietary text. This tester compiles and runs patterns with the browser's native RegExp engine — no server, no logging, no copy retained. Paste sensitive samples without worry.
Common use cases
- Debug why a validation pattern rejects real input
- Build email, URL, or phone-number patterns interactively
- Preview find-and-replace across pasted text or logs
- Learn regex with the built-in cheatsheet and live feedback
Cleaning up the text you matched? Run it through ToolsOfWeb’s Text Cleaner to normalize whitespace, or compare two versions with the Text Diff Checker.
FAQs
A regex tester lets you try a regular expression against your own text and see every match instantly — highlighted in the text, listed with capture groups, and with errors explained. It is the fastest way to build and debug patterns without running code.
No. Testing runs entirely in your browser using JavaScript’s built-in RegExp engine. Nothing you type ever leaves your device.
JavaScript (ECMAScript) regular expressions — the same engine that runs in your browser and in Node.js. Most syntax transfers directly to Python, Java, and other languages, though some advanced features differ by flavor.
g finds all matches instead of stopping at the first; i ignores case; m makes ^ and $ match line boundaries; s lets . match newlines; u enables full Unicode mode; y (sticky) matches only from the current position. Toggle them above the test box to see the difference live.
Usually an unbalanced bracket or parenthesis — for example [a-z without the closing ]. The tester shows JavaScript’s exact error message, which normally points at the problem character.
Parentheses create groups: (\w+)@(\w+) captures the username as group 1 and the domain as group 2. The match list shows every group’s value, and in Replace mode you can reuse them with $1, $2, and so on.
More free tools
JSON Formatter
Client-side • No sign-up
Text Diff Checker
Client-side • No sign-up
HTML Formatter
Client-side • No sign-up
Text Cleaner
Client-side • No sign-up
Case Converter
Client-side • No sign-up
Base64 Encode & Decode
Client-side • No sign-up
Want guides and tips? Visit the ToolsOfWeb blog or go back to the homepage.
Related guide
Read guide: regex tester (flags, capture groups, debugging patterns) →
