Regex Tester
Enter a regular expression pattern, select flags (g, i, m, s, u), and paste a test string. All matches are highlighted inline, and each match's captured groups are listed below. Invalid patterns show a descriptive error instead of crashing. All processing is local — your patterns and strings stay in the browser.
This tests JavaScript regular expressions. Python, PHP and other languages differ in places.
Related Tools
[4 suggestions]Diff Checker
Compare two blocks of text line by line and highlight additions, deletions, and changes.
Developer & WebJSON Formatter
Validate, pretty-print, and minify JSON with clear error reporting for invalid input.
Developer & WebBase64 Encoder / Decoder
Easily encode plain text to Base64 format or decode Base64 back to readable text.
Developer & WebFind and Replace Text
Find and replace text in bulk with match case, whole word, and regular expression options.
Case & FormattingGuides for the Regex Tester
- How to Find and Replace Text: Whole Words, Regex and Line Breaks
Learn how to find and replace text in bulk: plain, whole word and regex modes, capture groups, line breaks and tabs. Checked against Python on 9,000 cases. (November 8, 2026)
- How to Extract Phone Numbers From Text Without Catching Dates and IDs
How to extract phone numbers from text: the formats to match, why dates, IP addresses and IDs fool a simple regex, and results tested on 245 countries. (November 3, 2026)
- camelCase vs snake case vs kebab-case: Which to Use and How to Convert
camelCase vs snake case vs kebab-case: which style each language and URL expects, the rules from PEP 8 and Google, and how to convert names correctly. (October 30, 2026)
- JSON Parse Error: Common Causes and How to Fix Each One
Fix a JSON parse error: 15 causes with the real error messages from Node 24 and Python 3.14, plus what valid JSON can still get wrong. (October 28, 2026)
About the Regex Tester
The Regex Tester builds a JavaScript RegExp from your pattern and the flags you switch on, then lists every match with its position and capture groups. With the g flag on it finds all matches. With g off it returns only the first, as JavaScript does. The flags are g (find all matches), i (ignore case), m (multiline: ^ and $ match at each line), s (dotAll: . also matches a line break) and u (Unicode: allows \p{L} and counts an emoji as one character). The pattern runs in a Web Worker with a one second limit, so a pattern that backtracks without end, such as ^(a+)+$ on a long run of a's that ends in a different character, is stopped with a message instead of freezing the page. The list stops at 1,000 matches. An invalid pattern shows the engine's error and leaves your test string alone. This is the JavaScript flavor: Python, PHP, Java and other engines differ in places, for example in named group syntax, lookbehind and inline flags. Developers use it to write and debug validation patterns, to build text extraction, and to test search-and-replace expressions before using them in an editor or script.
What regex flags are supported?▾
Five flags: g (global: find all matches; with it off only the first match is returned), i (ignore case), m (multiline: ^ and $ match at each line), s (dotAll: . matches a line break too) and u (Unicode: enables \p{L} and treats an emoji as one character).
How are capture groups shown?▾
For each match, the tool lists every numbered capture group (the parts of the pattern in parentheses). Named capture groups ((?<name>...)) are shown with their names. Unmatched optional groups show as "empty".
What happens if my pattern is invalid?▾
If the RegExp constructor throws a SyntaxError (e.g. unbalanced brackets or an invalid escape), the tool displays the error message in red below the pattern field without clearing your test string.
Why was my pattern stopped after one second?▾
The pattern was probably backtracking catastrophically. Nested repeats such as (a+)+ can try an enormous number of ways to split the text when the match almost succeeds, and the time roughly doubles with each extra character. The tester stops it after a second so the page stays usable. Make the repeats unambiguous, for example a+ instead of (a+)+.