Regex Tester

Test regular expressions with live matches.

Flags

Highlighted matches
Matches 0

Free online regex tester

This regex tester lets you build and debug regular expressions in real time. Type a pattern, toggle the flags you need, and paste some sample text — every match is highlighted instantly, counted, and listed with its position and capture groups. It uses your browser's native JavaScript engine, so what you see here is exactly what your code will do. It's ideal for validating input, extracting data, cleaning up messy text, and learning how regular expressions behave.

How to test a regular expression

  1. Type your pattern in the Regular expression box (no slashes needed).
  2. Tick any flags you want, such as g for global or i to ignore case.
  3. Paste or type your sample text into the Test string area.
  4. Read the highlighted matches, the total count, and each capture group below.
  5. Use Copy matches to grab every matched value at once.

Understanding the flags

Flags change how the whole pattern is applied. g returns all matches, i makes matching case-insensitive, m and s control how line breaks are treated, u enables full Unicode support, and y anchors matching to a fixed position. If your pattern is invalid, a red message shows the exact error so you can fix it quickly.

Related tools

Once your text is extracted, you can tidy it further: turn a title into a clean permalink with the slug generator, or check structured output in the JSON formatter. Everything runs locally in your browser, so your patterns and data never leave your device.

Frequently asked questions

Which regex flavour does this tester use?

It uses the JavaScript (ECMAScript) regular-expression engine built into your browser, the same one used by RegExp, String.match, and String.replace. Patterns behave exactly as they would in your JavaScript, TypeScript, or Node.js code.

What do the g, i, m, s, u, and y flags do?

g (global) finds every match instead of stopping at the first. i ignores case. m (multiline) makes ^ and $ match at line breaks. s (dotall) lets the dot match newlines. u enables full Unicode handling. y (sticky) matches only starting from the current position.

Why does my pattern show a red error?

A red message means the pattern is not valid — often an unbalanced bracket or parenthesis, a stray backslash, or an unfinished group. The exact browser error text is shown so you can find and fix the problem. Results stay cleared until the pattern is valid again.

Is my pattern or test text sent to a server?

No. Everything runs entirely in your browser with JavaScript. Your regular expression and test string are never uploaded or stored, so it is safe to test patterns against private data.

How are capture groups shown?

Each match is listed with its position (index) in the text and the contents of every capture group in order, so you can confirm that parentheses in your pattern are capturing exactly what you expect.