How to use the Regex tester tool
- Type the expression into Pattern without the surrounding slashes, for example \d{4}-\d{2}.
- Add flag letters such as i, m, s or u under Flags if you need them. The g flag is always applied.
- Paste the sample text into the Text box, up to 200,000 characters.
- Select Find matches. Select Example to run a sample pattern first.
- Read the match count and the list of matches in the Result box, then select Copy to keep them.
How the regex tester evaluates a pattern
The tool passes Pattern and Flags to the RegExp constructor and collects results with matchAll. This is the ECMAScript regular expression engine, the same one your front-end code runs on. The global flag is added automatically if you leave it out, so you always get all matches, not only the first.
Matching runs in a Web Worker, a background thread separate from the page. If the expression has not finished after 2 seconds, the worker is terminated and you get a timeout message. That protects the tab from catastrophic backtracking, for example a nested quantifier like (a+)+ applied to a long string that almost matches.
Worked example with capture groups
The pattern below has three capture groups for year, month and day. The text contains two dates, so the result lists two matches. The index value is the zero-based position where the match starts, counted in UTF-16 code units as JavaScript strings are.
Pattern: (\d{4})-(\d{2})-(\d{2})
Text: Released 2024-05-17, patched 2024-06-03.
2 matches
[
{
"index": 9,
"match": "2024-05-17",
"groups": [
"2024",
"05",
"17"
]
},
{
"index": 29,
"match": "2024-06-03",
"groups": [
"2024",
"06",
"03"
]
}
]Flags you can use
Enter the letters together with no separators, for example im. An unknown or repeated letter is rejected with the engine's error message.
- i ignores case.
- m lets ^ and $ match at every line break, not only at the ends of the text.
- s lets the dot match line terminators.
- u enables Unicode mode, so an emoji counts as one character and property escapes such as \p{L} work.
- v is the newer Unicode sets mode with subtraction and intersection in character classes. It cannot be combined with u.
- y is sticky matching: each match must start exactly where the previous one ended.
- d is accepted but changes nothing visible, since the result does not print group indices.
Reading the results and their limits
The groups array holds the capture groups in order of their opening parenthesis. Named groups appear by position, not by name. A group that did not take part in the match shows as null, and a pattern with no groups gives an empty array.
The list stops at 1,000 matches without a warning, so a count of exactly 1,000 probably means there are more. A pattern that can match nothing, such as an empty one, produces a zero-length match at every position. The tool only finds matches; it has no replace or split mode.
Frequently asked questions
Which regex flavor does this tester use?
The JavaScript flavor defined by ECMAScript, as implemented by your browser. Lookbehind, named groups and Unicode property escapes are available in current browsers. PCRE, Python, Java and .NET differ in places, so retest a pattern in the target language before you ship it.
Do I need to add the g flag?
No. The tool appends g when it is missing, because it uses matchAll to collect every match. Typing g yourself is harmless. Typing it twice is an error, since a flag may appear only once.
Why did I get a 2-second limit error?
The engine was still searching when the time limit expired. The usual cause is catastrophic backtracking: nested or overlapping quantifiers that give the engine exponentially many ways to fail. Make the inner part more specific, anchor the pattern, or remove one level of repetition.
How should I write backslashes in the Pattern field?
Write them once, as in a regex literal: \d+ for digits or \. for a literal dot. Doubling is only needed inside string literals in source code. Do not wrap the pattern in slashes, because they would be matched as literal characters.
Is my test text uploaded?
No. The pattern and text are handed to a worker thread inside your own browser, and the matches come back to the page. Log excerpts and other sensitive samples stay on your device.