Regex Tester
Write a JavaScript regular expression, choose flags and see matches highlighted in your text, with every capture group listed.
Up to 200,000 characters. Each search runs in a separate background thread and is stopped after 1.5 seconds, so a runaway pattern cannot freeze the page.
About Regex Tester
A regular expression is a small pattern language for finding text. Regex Tester runs your pattern with the JavaScript engine built into your browser, highlights every match in your sample text and lists what each capture group caught. Because the browser does the matching, the results are exactly what String.prototype.match or RegExp.exec would give in JavaScript code.
Some patterns take an enormous time on certain inputs, a problem known as catastrophic backtracking. A normal page would freeze. Here every search runs in a separate background thread (a Web Worker), and if it has not finished after 1.5 seconds the thread is stopped and you see a warning instead.
When to use it
- You are writing validation for a form field and want to test it against good and bad examples.
- You need to pull dates or order numbers out of a log and check that the groups capture the right parts.
- A pattern in production is slow and you want to see whether it backtracks.
Worked example
Enter the pattern (\d{4})-(\d{2})-(\d{2}) with the g flag and the text Paid 2026-11-14, due 2026-12-01. The tool reports 2 matches and 3 capture groups. The first match, 2026-11-14, covers positions 5-15 and its groups are 2026, 11 and 14; the second is 2026-12-01 at 21-31. Now try ^(a+)+$ against thirty letters a followed by !. The nested quantifier makes the engine try a huge number of ways to split the letters, the search is stopped after 1.5 seconds and you are told why.
Good to know
- Write the pattern without the surrounding slashes; flags are tick boxes.
- Without the
gflag only the first match is shown, as in JavaScript. - Named groups (a question mark and a name in angle brackets after the opening parenthesis) show their name in the table.
- Limits: 200,000 characters of text, 1,000 matches collected, 200 shown in the table.
- Other regex flavours (PCRE, Python, Java) differ in some features.
- To compare two outputs side by side, use Text Compare.
How to use Regex Tester
- Type the pattern without the surrounding slashes.
- Tick the flags you need, such as g for all matches or i to ignore case.
- Paste test text and read the highlighted matches and the groups table.
Privacy: how it works
Your pattern and text are processed in your browser and never uploaded.
Frequently asked questions
Which regex flavour does it use?
Your browser’s JavaScript engine, so results match what JavaScript code does. Other languages such as PCRE, Python or Java differ in some features.
What happens if my pattern hangs?
Each search runs in a background thread and is stopped after 1.5 seconds. You then see a warning about catastrophic backtracking instead of a frozen page.
Are there limits?
Test text can be up to 200,000 characters and patterns up to 2,000 characters. At most 1,000 matches are collected, and the table shows the first 200.