Regex Tester

Test regular expressions in real time with live match highlighting, capture group details, and find-and-replace. Supports all JavaScript regex flags — no signup, no install, runs entirely in your browser.

Regex tester · 100% client-side · Live highlighting
Quick Presets
Pattern
/
/gi
Test String
Match Details
Enter a pattern and test string to see matches
Replace
Replace result will appear here
Cheatsheet — click to insert

How to Use the Regex Tester

Writing a Pattern

Type your regular expression directly into the pattern field. The tool uses JavaScript's RegExp engine, so any pattern that works in a browser console will work here. Matches are highlighted in your test string in real time as you type.

Flags

  • g — global: find all matches, not just the first
  • i — case-insensitive: match upper and lower case equally
  • m — multiline: ^ and $ match the start and end of each line
  • s — dotAll: . also matches newline characters

Capture Groups and Replace

Wrap part of your pattern in parentheses to create a capture group. The Match Details panel shows each group's value. In the Replace field, use $1, $2, … to reference groups, $& for the full match, or plain text for a literal replacement.

FAQ

What regex flavour does this tester use?

The tester uses JavaScript's built-in RegExp engine. It supports flags g, i, m, and s. Lookbehind, named capture groups, and Unicode escapes work in any modern browser.

How do I use capture groups in the replace field?

Use $1, $2, … to reference capture groups. $& inserts the full match. For example, replacing (\w+)\s(\w+) with $2 $1 swaps two words.

Why does my pattern match more than expected?

The global (g) and case-insensitive (i) flags are on by default. Toggle them off to restrict matching. Quantifiers like * and + are greedy — add ? after them for non-greedy matching.

Does this tool send my data to a server?

No. Everything runs entirely in your browser. Your regex patterns and test strings are never transmitted to any server.

Is there a limit on the length of the test string?

There is no hard limit. Very long strings with thousands of matches may cause a brief delay, but typical inputs — log lines, code snippets, API responses — are handled without issue.

Related Tools