Regex Tester
Test a JavaScript regular expression against your own sample text, see every match highlighted inline, and inspect each match's index and capture groups — all in your browser.
Regex Tester features
JavaScript RegExp engine
Matches use your browser's native JavaScript RegExp, so results mirror real JS code exactly.
Inline match highlighting
Every match is highlighted directly in your test string so you can see what the pattern catches.
Capture group breakdown
Each match lists its numbered and named capture groups so you can confirm what was extracted.
Match index reporting
See the position of every match in the text, making it easy to locate results precisely.
Full flag support
Use g, i, m, s, u, and y flags to control global, case-insensitive, multiline, and sticky matching.
Private and client-side
Your pattern and text never leave the browser — nothing is uploaded or stored on a server.
Overview
A regular expression (regex) is a pattern that describes a set of strings. It is used to find, match, and extract text — for example, validating an email address, pulling dates out of a log, or finding every word that starts with a capital letter. This tool uses the native JavaScript RegExp engine built into your browser, so the matching behavior is exactly what you would get from running the same pattern in JavaScript.
You provide three inputs: a Pattern (the regex itself, without the surrounding slashes), a Test string (the sample text to search), and a Flags field. Flags change how the pattern is applied — for example g finds all matches instead of just the first, i makes matching case-insensitive, m treats ^ and $ as line boundaries, and s lets . match newlines.
The tester highlights every match inline in the test string and also lists each match individually with its position (index) and any capture groups. Both numbered groups (from parentheses like (\d+)) and named groups (like (?<year>\d{4})) are shown, so you can verify that your pattern captures exactly the parts you expect.
Because everything runs locally with the browser's own regex engine, you get instant feedback as you refine a pattern — no round trip to a server and no waiting.
How to use the Regex Tester
- Type or paste your regular expression into the Pattern field (do not include the surrounding slashes).
- Paste the sample text you want to search into the Test string area.
- Enter any flags you need in the Flags field, such as g for all matches, i for case-insensitive, or m for multiline.
- Watch the matches highlight inline within your test string as you type.
- Read the list of matches below to see each match's index and its numbered and named capture groups.
- Adjust the pattern or flags and copy the working regex once it matches what you intended.
Good to know
A few things worth keeping in mind when testing patterns here:
- This tester uses the JavaScript regex flavor. Syntax that works in PCRE, Python, or .NET (such as certain lookbehind or recursion features) may behave differently or not be supported.
- Remember to include the
gflag when you want all matches — otherwise only the first match is returned. - Inside the Pattern field you do not need to escape the forward slash
/, since there are no surrounding delimiters. - An overly broad pattern (for example one with heavy backtracking) can run slowly on very large test strings, because it executes with the browser's own engine on your machine.
Private by design
Every byte you paste into the Regex Tester is processed locally in your browser. Formatly makes no network request with your data, logs nothing, and stores nothing on any server — so it is safe for API responses, tokens, configuration and other sensitive content. Your most recent input and theme are saved only in your own browser's local storage.
Regex Tester FAQ
Is my pattern and test text private?
Yes. The Regex Tester runs entirely in your browser using the native JavaScript engine. Your pattern, flags, and test string are never uploaded to a server, logged, or stored remotely — they stay on your device.
Does this work offline?
Yes. Once the page has loaded, all matching happens locally with your browser's built-in RegExp engine, so it keeps working even without an internet connection.
What is the difference between this and the built-in regex in my code editor?
This tool uses the JavaScript flavor of regular expressions. Editors and other languages (such as PCRE, Python, or Java) have slightly different syntax and supported features. Because this tester uses the same engine as a browser or Node.js, the results match what your JavaScript code will actually do — which may differ from a non-JavaScript regex tool.
What do the flags do?
Flags modify how the pattern is applied. Common ones are g (find all matches, not just the first), i (case-insensitive), m (multiline, so ^ and $ match line starts and ends), s (dotAll, so . matches newlines), u (Unicode mode), and y (sticky matching from a fixed position).
Why am I only getting one match?
Without the g flag, JavaScript returns only the first match. Add g to the Flags field to find and highlight every match in your test string.
Does it show capture groups?
Yes. For each match, the tool lists both numbered groups (from parentheses like (\d+)) and named groups (like (?<name>...)), so you can verify exactly which parts of the text your pattern captured.
Do I need to add slashes around my pattern?
No. Enter only the pattern itself in the Pattern field — leave out the surrounding /.../ delimiters. Put any flags separately in the Flags field instead of after a closing slash.