Test and debug regular expressions
All computation runs locally in your browser

—
The Regex Tester helps you validate a JavaScript regular expression against a block of text. You can toggle common flags, see the match list (including captures and named groups), preview highlighted matches, generate a sample string that matches your pattern, and view a diagram of the regex structure.
The fastest way to debug regex is to make it visual: a match list tells you “what”, and flags + diagram help you see “why”.
If you’re working with tokens or auth headers, you might also find our JWT parser and Basic auth generator helpful.
Worked example (with indices)
Suppose your text is abc123xyz and your regex is \\d+. The match is 123, starting at index and ending at (end-exclusive).
Here is the matched length. This is a quick sanity check: the highlighted region should be exactly 3 characters long.
Log parsing
Background: you need to extract request IDs. Input: text contains req-1042. Regex: req-(\\d+). Result: capture .
Quick validation
Background: you want a “rough” email check. Regex: ^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$. Result: match/no-match helps you filter obvious mistakes.
Refactoring text
Background: you’re preparing a search/replace. Use the tester to confirm captures/groups before you apply changes in an editor.
Token inspection
Background: you receive a string that “looks like” a JWT. Regex can detect the three-part structure quickly, then you can decode it with our JWT parser.
You need all matches, not just the first
Turn on the global flag (g). Without it, many regex engines stop after the first match.
You’re matching across lines
Use multiline (m) for ^ and $, and singleline (s) when you want . to include newlines.
Your pattern involves Unicode characters
Enable Unicode (u) to treat the pattern as Unicode code points and avoid surprises.
You rely on named groups
Named groups improve readability. The match table shows both numbered captures and named groups.
You’re preparing a risky replace
Use the captures table to confirm group boundaries before making bulk edits.
You want a quick sanity-check
The highlighted preview is the quickest way to confirm that the engine matches what you think it matches.
When it might not be the right tool: if you need PCRE-only features (common in some backend stacks), a JavaScript tester won’t match 1:1. In that case, use the tester that matches your runtime.
Start narrow, then generalize
First match a tiny, known substring. Then expand to cover edge cases.
Use non-capturing groups when you can
Prefer (?:...) unless you actually need to capture—it keeps your group numbers stable.
Watch for empty matches
Patterns like .* can match empty strings and behave surprisingly with global matching.
Be careful with catastrophic backtracking
Some patterns become very slow on long inputs. If the regex feels “hangy”, simplify or anchor it.
This tool uses the JavaScript RegExp engine. It runs the pattern against your text and reports: the match index, the matched value, numbered captures, and named groups.
Index model
Each match spans a half-open interval in the text. The match length is:
The highlighted preview uses the same boundaries, so it’s a direct visual check.
Flags in plain English
g: Find all matches (not just the first).
i: Ignore case (A equals a).
m: ^ and $ treat newlines as boundaries.
s: . can match newlines.
u: Treat the pattern as Unicode code points.
v: Unicode sets mode (newer JS feature).
Turn on the global flag . Without it, many regex operations return only the first match.
Use multiline when you expect ^ and$ to work per line.
If the pattern is invalid, the visualizer may fail to render. Try simplifying the regex until it displays again.
Not always. This tester uses JavaScript regex behavior. If your backend uses PCRE, .NET, or another engine, some features and edge cases may differ.
The calculator runs locally in your browser. Still, avoid pasting secrets into any tool unless you’re comfortable with the risk.
Regex behavior differs between engines. Treat these results as JavaScript-specific unless you confirm compatibility. Also, very complex regex patterns can be slow on large inputs.
Further reading
Use a simple chronometer (stopwatch) to track elapsed time down to milliseconds. Runs locally in your browser.
Normalize email addresses to a standard format for easier comparison. Useful for deduplication and data cleaning. Runs locally in your browser.
Estimate the time needed to consume a total amount at a constant rate, and get an expected end time. Runs locally in your browser.
Parse and decode your JSON Web Token (JWT) and display its content. All computation runs locally in your browser.
Know which file extensions are associated to a MIME type, and which MIME type is associated to a file extension. Includes a full MIME types table.
Generate random Lorem Ipsum placeholder text with customizable paragraphs, sentences, and word counts. Runs locally in your browser.