---
title: "Regex Tester"
description: "Test JavaScript regular expressions with live match highlighting, capture groups, and all six flags. Runs fully in your browser."
url: "https://freshjuice.dev/tools/regex-tester/"
---
## About this tool

Matches highlight live in your test string as you type, with the match list below showing index, value, and capture groups. The engine is your browser's native `RegExp`, so what you test is exactly what your JavaScript will do — no server round-trip, no flavor guessing.

## Flags

-   `g` global — find all matches, not just the first
-   `i` ignore case
-   `m` multiline — `^`/`$` match line boundaries
-   `s` dotall — `.` matches newlines
-   `u` unicode — full Unicode semantics
-   `y` sticky — match only at `lastIndex`

Zero-width matches are handled safely (no infinite loops), and results cap at 10,000 matches so a greedy pattern can't freeze the tab.

## Frequently Asked Questions

### Which regex flavor does this tester use?

Your browser's native JavaScript `RegExp`: the exact engine that will run your code, zero flavor guessing. That matters, because lookahead, named groups, and Unicode property escapes behave differently between PCRE, Python, and JavaScript. Testing against the real engine means no "worked in my tester, broke in prod" surprises.

### Why does my regex work on one site but not here?

Flavors differ. Sites built on PCRE (PHP, older testers) support recursion and possessive quantifiers natively; JavaScript doesn't. Python requires raw strings for backslashes; JavaScript has its own escaping rules in string literals. And ES2018+ features like lookbehind and named capture groups (`(?<name>…)`) won't run in old browsers at all. If a pattern works elsewhere but not here, check which construct you're relying on.

### What do the six flags do?

`g` (global) finds all matches instead of stopping at the first. `i` ignores case. `m` (multiline) makes `^` and `$` match line boundaries instead of string boundaries. `s` (dotall) lets `.` match newlines. `u` (unicode) enables full Unicode semantics: emoji, astral characters, property escapes like `\p{L}`. `y` (sticky) matches only at the current `lastIndex`. Combine them freely.

### Why is my regex matching nothing or everything?

The two classic footguns. Matching *everything* usually means a quantifier can match zero characters (`a*` happily matches the empty string everywhere). Matching *nothing* usually means an unescaped special character: `.` matches any character, so `file.txt` matches `fileXtxt`; you meant `file\.txt`. The match list shows index and value for each match, which makes both cases obvious.

### Is my regex safe from ReDoS?

Test it here and find out. Catastrophic backtracking (nested quantifiers like `(a+)+$` against a long non-matching string) takes exponential time. This tester caps results at 10,000 matches and handles zero-width matches safely, so a pathological pattern visibly hangs the highlight rather than silently freezing your tab. If it's slow here, it's a DoS vector in production.

### Does it support capture groups and backreferences?

Yes. Numbered groups, named groups, and backreferences (`\1`) all work, and the match list shows each group's captured value. That's the fastest way to debug "why did group 2 capture the wrong thing": see exactly what matched at exactly which index.
