Regex Tester
Test JavaScript regular expressions live: highlight matches, see numbered and named capture groups in a table, preview replacements and learn what each flag does.
π Runs entirely in your browser β nothing is uploadedWhat Regex Tester does
Regex Tester runs a JavaScript regular expression against sample text as you type, highlights every match with alternating colours, and lists each match in a table with its position and every capture group. Named groups such as (?<year>\d{4}) are labelled with their names, and groups that did not participate in a match are shown as undefined, so optional parts of a pattern are easy to debug. Hover a highlighted match to see its groups.
Add a replacement to preview String.prototype.replace output with $1, $<name>, $& and the other substitution tokens β ideal for refactoring with an editor's regex search or writing data clean-up scripts. All eight flags are available: global, ignore case, multiline, dotAll, unicode, unicodeSets, sticky and hasIndices, each with a short explanation. It is useful for validating log parsing patterns, form validation snippets, route matching, and small extraction tasks before the expression is copied into code.
Private browser-based workflow
All processing happens with in-browser JavaScript. The tool does not upload your text, tokens, URLs, snippets, or generated values to a server, and it does not require an account. That privacy model is important because small utilities often receive real API responses, configuration samples, logs, authentication data, or customer-shaped examples during troubleshooting. Keeping the work local reduces risk and also makes the tool feel instant because there is no network round trip.
Practical tips
Without the g flag only the first match is reported, exactly as RegExp.exec behaves in code. Zero-length matches are listed but not highlighted to avoid confusing output. Use the u or v flag when your pattern contains emoji or \p{β¦} Unicode property classes. Because browser RegExp behavior is the source of truth here, results match modern JavaScript and Node.js, but other engines such as PCRE, Python and .NET differ in details like lookbehind and named-group syntax. Patterns with nested quantifiers such as (a+)+ can backtrack catastrophically; if the page slows down, simplify the pattern.
How to use
- Enter pattern and flagsType a JavaScript regex or paste a /literal/flags and tick the flags you need.
- Paste textAdd sample text; matches update as you type.
- Review matches and replaceInspect highlights and the group table, and preview a replacement.
Frequently asked questions
Should I include slashes?
Can I test search and replace?
Which engine and flags are used?
RegExp engine with all flags: g, i, m, s, u, v, y and d. Each active flag is explained under the checkboxes.