About Regex Tester
Regex Tester runs a JavaScript regular expression against the text you supply and lists what it matched, so you can see whether a pattern behaves the way you expect before it goes anywhere near production code. The pattern and the flags are separate fields, which mirrors how the pattern would be written in real code.
Flag behaviour follows the JavaScript specification, and the global flag changes the result substantially. With it, every non-overlapping match in the input is returned as a list. Without it, only the first match is returned — along with any capture groups the pattern defines.
That last point is worth reading carefully, because it makes the reported match count misleading. For a non-global pattern containing capture groups, the count includes the captured substrings as well as the whole match, so a single match with two groups is reported as three. Read the listed values rather than the number when groups are involved. An invalid pattern is not a problem — the engine error is shown verbatim, which is usually the fastest explanation of what the pattern got wrong.
What you get back is a list of matched text and nothing beyond it. There is no highlighting of the matches inside the input, so you cannot see where in the text they occurred, no index or offset for any match, and no view of named capture groups as distinct from numbered ones. Substitution is not offered either: the page will show you what a pattern matches but not what it would replace it with, so testing a pattern intended for a replace operation means reading the match list and reasoning about the result. The input is also held in a plain field rather than a full editor, so there is no syntax colouring to help you balance brackets, and no way to point the tester at a pattern written for a non-JavaScript engine.
How to use Regex Tester
- 1 Enter the pattern without the surrounding slashes.
- 2 Enter the flags you want, such as the global and case-insensitive ones.
- 3 Paste the text to test against.
- 4 Read the matches, and check the count against the listed values when the pattern has capture groups.
Frequently asked questions
Why is the match count higher than the number of matches I expected?
Because a non-global pattern returns the whole match followed by its capture groups, and the count includes all of them. One match with two groups reports as three. The listed values show which is which, so read those rather than the total.
Does it use the same regex dialect as my language?
It uses JavaScript regular expression semantics, which are close to but not identical to other engines — differences in lookbehind support, named groups and Unicode property escapes mean a pattern that works here can behave differently elsewhere. Test in the target runtime before shipping.
How do I test a pattern with only one match?
Leave the global flag off. That returns the first match and its capture groups, which is what you want when the goal is to inspect the shape of a single match rather than to find every one.
Why does my pattern match an empty string?
Empty matches are legal and a common sign of an optional or star-quantified group that can be skipped entirely. In a global search they produce many zero-length results, which is typically the moment to anchor the pattern more tightly.
Free, online, and private
Free to use
Regex Tester is completely free. There is no account to create, no login, and no hidden charge or usage limit.
Runs online in your browser
It is a free online tool that runs entirely in your browser. Nothing to download or install — open the page and start using it right away.
Your data stays private
All processing happens locally on your device. Your input is never uploaded, stored, or tracked, so it never leaves your browser.
How Regex Tester behaves in detail
These are the specifics of this implementation — the exact ranges, defaults and fixed settings you are working with.
| Parameter | Value |
|---|---|
| Inputs | pattern, flags, and the text to test against |
| Flags supported | the standard set, g i m s u y — whatever the browser accepts |
| Output | the match count, then each match numbered [0], [1], … |
| Match listing | top-level matches only — capture groups are not broken out |
| Default sample | pattern \d+ against "There are 12 apples and 34 oranges." |
Compiled from the implementation of this tool and checked against it by itoolnet.
What Regex Tester does not do
Knowing the edges of a tool saves more time than another list of its features. These are the cases where it will not do what you might expect.
- Capture groups are not extracted into a table. A pattern like (\d{4})-(\d{2}) reports the whole matched span, so the individual year and month you captured are not shown separately.
- Only the first match is used to decide "is there a match at all"; the remaining matches are then listed. Replace-with-a-group syntax, lookbehind support and sticky-flag behaviour all depend on the browser and are not validated here.
Tested and documented by itoolnet, the team that builds and maintains this site.