Regex Tester
Test regular expressions live against sample text, with match highlighting, capture groups, find and replace, and all six flags.
Matches update live as you type. Nothing leaves your browser.
Enter a pattern to start matching.
Quick reference
\d \w \sDigit, word character, whitespace. Capitals negate..Any character except a newline (any at all with the s flag).* + ?Zero or more, one or more, optional.^ $Start and end of the text, or of each line with the m flag.[abc]Any one character from the set. [^abc] means none of them.(...)Capture group. (?<name>...) gives it a name.(?=...)Lookahead: match only when followed by this, without consuming it.\bWord boundary, the edge between a word character and anything else.How to test a regular expression online
Enter a pattern
Type the regular expression between the slashes. It is checked live, and any syntax error appears under the field as you type.
Toggle the flags
Switch g, i, m, s, u, and y on or off with the flag pills. Global matching is on by default so every match is found.
Paste your test text
Add the text to match against. Matches are highlighted in place, with a count and a table of capture groups.
Copy the matches
Copy matches puts every full match on its own line on your clipboard.
Replace matches
Type a replacement to preview find and replace live. Reference a captured group with $1 or $<name>, and $& for the whole match.
Why use this tool
Live match highlighting
Matches are marked directly in your test text as you type, with alternating tints so adjacent matches stay distinguishable.
Capture group table
Every match lists its position, full text, and capture groups, including named groups, in one table.
All six flags
Toggle global, ignore case, multiline, dot all, unicode, and sticky matching with one click each.
Live find and replace
Type a replacement and the substituted text updates instantly. Capture group tokens like $1, $<name>, and $& are supported, and the global flag decides replace-all versus first-only.
Exact error messages
An invalid pattern shows the browser's own error message under the field, so you see precisely what was rejected.
Built-in quick reference
Common tokens like \d, \w, anchors, quantifiers, and lookaheads sit in a collapsible reference below the tester.
Nothing leaves your browser
Patterns and test text are processed on your device. Logs and data you paste are never uploaded.
About this tool
Regular expressions describe patterns in text: an email shape, a timestamp, a product code, anything with structure. They drive validation rules, search and replace in editors, route matching, and log filtering, which also makes them easy to get subtly wrong. This regex tester runs your pattern against sample text as you type, highlights every match in place, and lists each match with its position and capture groups, so you can see what a pattern actually does instead of reasoning about it in your head.
The tester follows the same dialect JavaScript and the web use, so what matches here matches in your frontend code, your server-side scripts, and most web tooling. That matters because regex dialects differ in small, expensive ways: lookbehind, unicode handling, and named groups are all written or supported differently across languages. Checking a pattern here first, with the exact flags it will ship with, catches those surprises before they reach production. All six standard flags are available as toggles, and an invalid pattern shows the browser's own error message under the field, so you see the real reason a pattern is rejected.
Everything runs on your device, which matters more here than in most tools: the text people test against is often production logs, user records, or config dumps that have no business being pasted into a server-backed site. Nothing you type is uploaded or stored. If the payload you are matching against is JSON, the JSON formatter validates it first. When the goal is cleanup rather than matching, remove whitespace strips stray spacing directly, and the URL encoder handles escaping for anything headed into a query string.
Frequently asked questions
- Which regex flavour does this tester use?
- The dialect JavaScript and the web use. A pattern that matches here behaves identically in browser code, server-side JavaScript, and most web build tooling. Other ecosystems, such as Python, Perl, and many command line tools, use their own dialects with small differences in syntax and supported features.
- What do the g, i, m, s, u, and y flags do?
- g finds every match instead of stopping at the first, i ignores letter case, m makes ^ and $ apply to each line rather than the whole text, s lets the dot match newlines, u turns on full unicode handling for characters outside the basic range, and y only matches at the exact position where the previous match ended.
- Why does a pattern that works in another language fail here?
- Regex dialects differ. Lookbehind, unicode property escapes, possessive quantifiers, and named groups are written differently or missing entirely across languages, so a pattern copied from a Python script or an old forum answer can behave differently or fail to compile. The error shown under the pattern field is the browser's own message, which points at the exact part that was rejected.
- Can I use it for find and replace?
- Yes. Enter a replacement below the matches and the substituted text appears live. Reference a captured group with $1 or $<name>, insert the whole match with $&, and write a literal dollar sign as $$. With the g flag on, every match is replaced; with it off, only the first one is.
- Is the text I test against uploaded anywhere?
- No. The pattern, the flags, and the test text are processed entirely on your device. Nothing is sent to a server, stored, or logged, which makes it safe to test against real log lines or data samples.
- Is there a limit on how many matches are shown?
- The highlighted view and the match table show the first 1,000 matches, with a note when the list is cut off. Counting stops at 100,000 matches to keep the page responsive. Typical test text never gets near either limit.
Related tools
JSON Formatter & Validator
Pretty-print, minify, or explore JSON as a collapsible tree, with syntax errors shown inline.
Slug Generator
Turn any title or phrase into a clean, URL-friendly slug for permalinks, paths, and filenames.
API Key Generator
Generate cryptographically random API keys and tokens in hex, base62, or base64url, with control over length, an optional prefix, and bulk output.
ASCII Table Reference
The full ASCII character set with decimal, hex, octal, binary, and HTML codes. Search by code, character, or name.
Atbash Cipher
Mirror the alphabet so A swaps with Z, B with Y, and so on. Atbash is its own inverse, so one field both encodes and decodes as you type.
Base32 Encoder and Decoder
Encode text to standard Base32 and decode Base32 back to text, following RFC 4648.