HohoTools
中文

Regex Tester

This free online regex tester shows exactly what a pattern does before you ship it into code.

How to use

  1. Type your regular expression into the pattern field — the global flag is added automatically.
  2. Paste the sample text below it; matches appear instantly with positions and capture groups.
  3. Read the match count, adjust the pattern, and copy what you need.
ADAdvertisement — this space keeps HohoTools free

Frequently asked questions

Which regex flavor does it use?

The JavaScript RegExp engine of your own browser — the same one your front-end code runs. Lookahead and lookbehind, named capture groups, Unicode property escapes and flags behavior all match what you will get in production JavaScript.

Do I need to add the global (g) flag myself?

No. The global flag is added automatically so the tester lists every match in the text instead of stopping after the first one. There is no flag input to worry about.

What happens with an invalid pattern?

You get the browser native error message — the exact SyntaxError text, such as an unterminated character class or a bad group name. Nothing is silently "fixed"; the message tells you precisely what to repair.

How are capture groups displayed?

Each match line is followed by its groups in order, with the value each group captured. A group that did not participate in the match is explicitly marked, so optional groups are never confused with empty strings.

Why does a huge match count stop the tool?

Patterns that match more than ten thousand times (often accidental quantifier mistakes) are stopped with an explicit error instead of rendering forever. Narrow the pattern or the sample text and retry.

Is my pattern or text uploaded?

No. Matching runs entirely in your browser. Patterns and sample text — including proprietary config snippets or log lines — never leave your device.

Related tools

About this tool

This free online regex tester shows exactly what a pattern does before you ship it into code. Enter a regular expression and sample text, and every match is listed in order with its position in the text and the full capture group breakdown, plus a live match count — so off-by-one groups and greedy quantifiers stop being surprises. The global flag is added automatically: you see all matches, not just the first one. The tool deliberately reports failure instead of masking it — an invalid pattern surfaces the browser native error message, the same diagnostic you would get in a JavaScript console, which makes the fix obvious. Zero-width matches are counted and advanced safely, and a runaway pattern that produces more than ten thousand matches is stopped with an explicit error rather than freezing the tab. Matching uses the browser regular expression engine directly, so lookahead, named groups and Unicode classes behave exactly as they will in your application. Everything runs locally in your browser: patterns and text never leave your device.