Regex Tester

Test regular expressions against text with live match highlighting and capture groups.

100% Free No signup Works in your browser No data uploaded
/ /

Flags: g (all matches), i (ignore case), m (multiline), s (dotall).

How to use the Regex Tester

Step 1 — Enter a pattern

  • Type your regex between the slashes and set flags (g, i, m, s).

Step 2 — Add test text

  • Paste the string you want to search.

Step 3 — Test

  • Matches are highlighted and counted; capture groups are listed.

Private

  • Everything runs in your browser.

Frequently asked questions

Which regex syntax does this use?

JavaScript regular expressions, since it runs in your browser. Most patterns are portable, though some features differ from other languages.

What do the flags mean?

g matches all occurrences, i ignores case, m makes ^ and $ match line starts and ends, and s lets the dot match newlines.

Does it show capture groups?

Yes. For patterns with parentheses, each match lists its captured groups as $1, $2, and so on, including empty captures.

What happens with an invalid pattern?

The tool catches the error and shows the exact message, so you can fix the pattern without anything breaking.

Is my text sent anywhere?

No. Matching runs entirely in your browser; the pattern and text never leave your device.

About the Regex Tester

This tool lets you build and test regular expressions against sample text, showing you exactly what matches and what each capture group contains. Regular expressions are powerful but easy to get subtly wrong, so seeing live results as you refine a pattern saves a lot of guesswork.

What regular expressions do

A regular expression is a compact pattern that describes a set of strings — an email shape, a date format, a price, a tag. They are used everywhere text is processed: validating form input, searching and replacing in editors, extracting fields from logs, and routing in web frameworks. The difficulty is that a pattern that looks right can match too much, too little, or nothing at all, and the only reliable way to know is to run it against real examples. That is what this tester is for.

Flags and matching

Flags change how the pattern behaves. The global flag g finds every match rather than just the first, which is what you usually want when extracting or counting. The i flag ignores case, m treats the text as multiple lines so the anchors match at each line break, and s allows the dot to span newlines. The tester highlights every match directly in your text so you can see at a glance whether the pattern is catching what you intended and nothing more.

Capture groups

Parentheses in a pattern create capture groups, which pull out parts of each match — for example separating the user and domain from an email. The tester lists the captured groups for each match as $1, $2 and so on, so you can confirm your groups are isolating the right pieces. This is invaluable when the regex feeds a replacement or extracts structured data.

Notes and privacy

Because it runs in the browser, the syntax is JavaScript's flavour of regex; most patterns are portable to other languages, but a few advanced features differ. Invalid patterns are caught and explained rather than failing silently. Nothing you type is uploaded. To compare two blocks of text, see the Text Diff Checker.

Copied to clipboard