Regular Expression Tester
FreeTest a regular expression against text using the native JavaScript regex engine, with live match highlighting, a full breakdown of numbered and named capture groups, and an optional replace mode that previews String.replace() output.
Runs entirely in your browser using the native JavaScript regex engine. Nothing is uploaded anywhere.
Highlighted matches
Matches
Recent Activity
Visible to everyone. Last 20 uses across all visitors, newest first.
Tested a pattern (50 chars, flags: g) -- 2 match(es)
1 hour ago
Tested a pattern (50 chars, flags: g) -- 2 match(es)
1 hour ago
Tested a pattern (50 chars, flags: g) -- 2 match(es)
1 hour ago
Tested a pattern (50 chars, flags: g) -- 2 match(es)
1 hour ago
Tested a pattern (50 chars, flags: (none)) -- 1 match(es)
1 hour ago
Tested a pattern (50 chars, flags: g) -- 2 match(es)
1 hour ago
What this tool does
This tool tests a regular expression against a block of text using the browser's native JavaScript regex engine. Matches are highlighted directly in the text, every match is broken down into its numbered and named capture groups, and an optional replace mode shows exactly what String.replace() would produce with your pattern and replacement text.
How It Works
Your pattern and selected flags are compiled into a real JavaScript RegExp object. When the Global flag is on, the tool repeatedly calls exec() on the text, advancing past each match (and past empty matches by one character to avoid an infinite loop) until no more matches are found; without Global, exec() is called once. Highlighting is built by walking through the matches in order and wrapping each matched substring in a marker while leaving the surrounding text untouched. Replace mode calls the text's own replace() method with your compiled pattern and replacement string, so the result is exactly what your own JavaScript code would produce.
Problems it solves
- Debugging why a regex in your actual JavaScript code is not matching what you expect, against the exact same engine.
- Previewing a find-and-replace operation before running it on real data.
- Understanding which part of a pattern each capture group corresponds to, by seeing every group's captured text at once.
- Learning regex flags hands-on by toggling them and watching the match list change immediately.
Frequently asked questions
›Which regex flavor does this tool use?
This tool runs your pattern through the browser's own native JavaScript RegExp engine, so it matches exactly how a regex would behave in real JavaScript code, in Node.js, or in a browser-side form validator, not a different flavor like PCRE (PHP, Python with the re module has its own quirks) or .NET regex, which can differ in lookbehind support, named group syntax, and a few other details.
›What do the g, i, m, s, and u flags actually change?
g (global) finds every match instead of stopping at the first one; i makes matching case-insensitive; m makes ^ and $ match the start and end of each line instead of only the whole string; s (dotall) makes . also match newline characters, which it otherwise does not; u enables full Unicode mode, which affects how character classes and surrogate pairs (characters outside the Basic Multilingual Plane, like many emoji) are handled.
›Why do some capture groups show as missing even though my pattern has parentheses?
A capturing group that is part of an alternation (A|B) only captures when that branch of the alternation actually matched, so a group from the branch that was not used is reported as not participating, this is standard regex behavior and not a bug in a particular match.
›How does replace mode interpret my replacement text?
Replace mode uses JavaScript's own String.replace() substitution syntax: $1, $2, and so on insert a numbered capture group, $<name> inserts a named group, $& inserts the entire match, and $$ inserts a literal dollar sign, exactly as it would behave in real JavaScript code.
›My pattern only matches once even though I expect several matches, why?
Check that the Global (g) flag is enabled, without it both the match list and String.replace() only act on the first match found, which is standard JavaScript regex behavior, not a limitation of this tool.
Related Tools
Text
Cron Expression Generator
Build and parse cron expressions with a live field editor, plain-English description, and the next 5 actual run times. Supports presets, @ shortcuts, and the optional 6-field seconds variant.
FreeText
DMARC Record Generator
Build a DMARC DNS record from plain-language fields, with staged rollout presets and a live enforcement-level indicator.
FreeText
Excel To HTML Table Converter
Paste from Excel or Google Sheets, or upload a .xlsx/.xls/.csv file, and get a clean HTML table with a live preview, optional styling, and numeric column alignment.
FreeText
Hash Generator (MD5/SHA1/SHA256/SHA512)
Hash text or a file into MD5, SHA-1, SHA-256, SHA-384, SHA-512, SHA3-256, SHA3-512, RIPEMD-160, and CRC32 all at once, with a compare field to check against a known checksum.
FreeText
htpasswd Generator
Generate a real Apache .htpasswd file with bcrypt or SHA, verified byte-for-byte against the official htpasswd command-line tool, with support for multiple users at once.
FreeText
HTML Entity Converter
Convert text to and from HTML entities in both directions at once, with decimal or hexadecimal numeric formats and a quick-reference table of common entities.
FreeText
HTML Validator
Check HTML for unclosed tags, duplicate IDs, deprecated elements, and other common well-defined issues, verified with its own tag-matching parser, not a full W3C conformance validator.
FreeText
IPv4 To IPv6 Converter
Generates IPv4-mapped, IPv4-compatible, 6to4, and NAT64 IPv6 representations of an IPv4 address, and extracts the IPv4 address back out of any of those IPv6 forms.
Comments (0)
Found this tool useful? Leave a comment, share a tip, or tell us how we can make it better.
No comments yet. Be the first to share your thoughts!