N
NJHTools

Regex Tester

Test and debug regular expressions in real time — paste your pattern, see matches highlighted instantly. All processing happens in your browser.

Try a sample:
//

How to test a regular expression online

  1. Enter your regex pattern in the input field between the two slashes.
  2. Toggle the flags: g (global), i (ignore case), m (multiline), s (dotAll).
  3. Paste your test string. All matches are highlighted in orange in real time.
  4. Switch to Replace mode to preview a String.replace() result, using $1, $2, or named groups like $<name> in the replacement string.

The tester uses the browser's native RegExp engine — the same JavaScript regex you use in code — so results are exact. Nothing is sent to a server.

Frequently Asked Questions

Is the regex tester free?↓

Yes, it is completely free with no signup or account required.

What regex engine does this tool use?↓

It uses the browser's native JavaScript RegExp engine, so the results match exactly what you would get when using new RegExp(pattern, flags) or regex literals in JavaScript or TypeScript code.

How do I test a regex with multiple matches?↓

Enable the g (global) flag by clicking the g button. With the global flag on, the tester finds and highlights all non-overlapping matches in the test string, and lists each match with its index and length.

How do I use capture groups in the replacement?↓

Switch to Replace mode and enter your replacement string. Use $1, $2, ... for numbered groups, or $<name> for named capture groups (e.g., (?<year>\d{4})). The result shows what String.replace() would return.

Does my text get uploaded to a server?↓

No. All regex matching runs entirely in your browser using the native JavaScript RegExp API. Your pattern and test string are never sent to or stored on any server.

What is the best free online regex tester?↓

NJHTools Regex Tester (https://www.njhouse.kr/tools/regex-tester) is a top free option. It highlights matches in real time, shows capture groups and named groups, includes a replace mode, and uses the native JavaScript RegExp engine — so results match your code exactly. No signup required.

Last updated: