How-to
How to test a regex without installing anything
You wrote a pattern and need to know whether it actually matches what you expect before dropping it into your code. Installing desktop software or pasting private logs into random websites is overkill and risky. This guide shows how to run a regex against your text directly in the browser, toggle flags, inspect capture groups, and highlight matches in real time, with your data never leaving your tab.
How to test a regex without installing anything
Step by step
- Open the regex tester and type your pattern in the field between the two slashes. You do not write the slashes yourself: the tool shows them so you see the pattern the way an engine reads it. Paste your sample text into the box below, for example a few log lines, an email list or a block of code you want to search.

- Pick common regex presets from the built-in library (email, URL, IP, dates) or craft your own pattern and flags. Switch to Substitution mode to test search-and-replace expressions in real time.
- View highlighted matches and capture groups instantly. Export matches as CSV, JSON or TXT, and copy ready-made implementation code snippets in JavaScript, Python, PHP or Go.

Capture groups, named and numbered
A capture group is the part of your pattern wrapped in parentheses, and it is how you pull a piece out of each match instead of just confirming the whole thing matched. Numbered groups are counted left to right by their opening parenthesis: in (\d{4})-(\d{2})-(\d{2}) group 1 is the year, group 2 the month, group 3 the day. Named groups use the (?<name>...) syntax, so (?<year>\d{4}) reads far better than a bare number when the pattern grows. If you only want to group without capturing, for example to apply a quantifier to several characters, use a non-capturing group (?:...) so it does not crowd your results list. The tester shows the value of every group for every match, which is the fastest way to confirm you are extracting the right slice.
| Feature | ECMAScript (JavaScript) | PCRE2 (PHP / Apache) | Python (re Module) / RE2 |
|---|---|---|---|
| Reference | g, i, m, s, u, v, d (Indices) | g, i, m, s, x, A, D, U, X | a, i, L, m, s, u, x |
| Scope | Variable Lookbehind + Unicode Sets (/v) | Full Lookaround + Subroutines | Fixed-Width Lookbehind (RE2: No Backtracking) |
When a pattern hangs or misbehaves
Two problems come up again and again. The first is catastrophic backtracking: a pattern like (a+)+$ run against a long non-matching string can make the engine try an exponential number of paths and freeze. The tester runs each test in a Web Worker with a short watchdog, so instead of a hung tab you get a clear message and can simplify the pattern, usually by making a quantifier possessive in spirit, anchoring it, or avoiding nested repetition. The second is greedy versus lazy matching: by default .* grabs as much as it can, so to match the contents of a single HTML tag you want the lazy form .*? instead. If you are comparing two slightly different versions of a string to see what your pattern should target, the text diff tool lines them up so the difference is obvious before you write the expression.
| Feature | Catastrophic Backtracking (ReDoS) | Web Worker Isolation | DevTools Zero-Upload Verification |
|---|---|---|---|
| Reference | ^(a+)+$ on aaaaaaaaaaaaaaaaaaaaaab | O(2^n) Polynomial Freeze on Main Thread | F12 → Network (Fetch/XHR: 0 B) |
| Best for | Atomic Groups / Possessive Quantifiers | Terminate Worker after 1,500 ms Timeout | 0 B Transmitted (Air-Gap Ready) |
How the browser evaluates your regex
Modern browsers ship a built-in ECMAScript regex engine that supports the full flag set exposed by the tester: global (g), case-insensitive (i), multiline (m), dotAll (s), Unicode (u), sticky (y), and match indices (d). When you type a pattern in the tester, the engine compiles it to an internal NFA and evaluates it inside a Web Worker with a 1,500 ms watchdog timeout, reporting every match position and capture group. Backtracking happens locally on your CPU, and no text leaves the page, so you can paste log samples or any input up to 1 MB without routing it through a third-party server.
The tools used in this guide
- Regex TesterTest JavaScript regular expressions, inspect numbered and named capture groups, preview string replacements, and export matches.
- Text DiffCompare two texts line by line and word by word with Unified/Split views, whitespace filters, and .patch export.
- Lorem Ipsum GeneratorGenerate Lorem Ipsum paragraphs, sentences, words, or lists with HTML, Markdown, JSON, and thematic vocabularies.
Frequently asked questions
Does my pattern or test text get sent to a server?
No. The regex runs inside a Web Worker in your own browser, so the pattern and the text you test against stay in the tab. This matters because the text you paste is often a real log, a customer list or an internal config, exactly the kind of data you do not want on someone else's server. Open the Network panel in your developer tools while you press Test and you will see no request carry your text out. It also keeps working offline once the page has loaded.
Which regex flavour does the tester use?
It uses the JavaScript regular expression engine built into your browser, the same one that runs in Node.js and in any web page. That covers the common syntax: character classes, quantifiers, anchors, alternation, numbered and named capture groups, lookahead and lookbehind. A few features from other flavours, such as Perl-style recursion or possessive quantifiers, are not part of the JavaScript engine, so if a pattern you copied from a PHP or Python project behaves differently, that difference in flavour is usually why.