# Free Online Regex Tester — Safe and Local

> Test a JavaScript regular expression against sample text. Matches and capture groups highlighted, runaway patterns stopped by a timeout. Free online.

Canonical: https://stayslocal.app/dev/regex-tester
Last updated: 2026-08-16

Write a pattern, paste some text, and see every match and capture group as you type. The pattern runs in a Web Worker with a timeout, so a pattern that would otherwise hang the browser stops instead of taking the page with it.

## JavaScript RegExp, and its flags

This is the ECMAScript flavour, the one that runs in browsers and Node — not PCRE, not RE2, not POSIX. The differences are real: JavaScript has no atomic groups, no possessive quantifiers and no recursion, and lookbehind is comparatively recent. A pattern that works in a PHP or Python tester can behave differently here, so test in the flavour you will actually ship.

Fields:
- g: Global — find every match rather than the first. It also makes the regex stateful via lastIndex, a classic source of skipped matches in loops.
- i / m: Case-insensitive, and multiline so ^ and $ match at each line break instead of only at the ends of the string.
- s / u / y: Dot-all so . matches a newline; Unicode mode for \p{…} property escapes and correct surrogate handling; sticky to anchor at lastIndex.
- Capture groups: (…) captures, (?:…) groups without capturing, (?<name>…) captures by name. Each match's groups are listed separately.
- Backtracking: Nested quantifiers like (a+)+b make the engine explore exponentially many paths — catastrophic backtracking, the basis of ReDoS.

## How to test a regex online

1. Write the pattern — Without the surrounding slashes; flags are separate toggles.
2. Paste realistic sample text — Include the awkward cases, not just the ones you expect to match.
3. Read the matches — Each match shows its position and its capture groups, named ones included.

## Where a regex tester saves time

- Working out a log line parser before putting it in a pipeline.
- Checking a validation pattern against inputs that should fail as well as pass.
- Building a find-and-replace for a large refactor and proving it on a sample first.
- Understanding a regex someone else wrote by watching what it captures.

## Questions

**What happens if my pattern never finishes?**

Execution runs in an isolated Web Worker with a time limit. If the pattern exceeds it the worker is terminated and you are told, rather than the tab freezing — which is what happens in a tester that runs the regex on the main thread.

**Is my sample text uploaded?**

No. The pattern and the text stay in this browser tab, so pasting a chunk of a production log to test against does not send it anywhere.

**Does it support PCRE or Python syntax?**

No. It is the JavaScript RegExp engine only. Recursion, atomic groups and possessive quantifiers do not exist here, and some \p{…} categories differ. Test against the engine you will deploy on.

**What is catastrophic backtracking?**

A pattern whose alternatives can match the same text in exponentially many ways — (a+)+$ against a long run of a's is the standard example. On attacker-controlled input it is a denial-of-service bug, which is why the timeout here is a feature rather than a limit.

## Related

- [Developer Tools](https://stayslocal.app/dev): every tool in this family
