JavaScript Regex Tester Online

Test JavaScript RegExp patterns against sample text, debug flags, inspect match indexes and review capture groups before using them in code.

Tool

JavaScript flags

You can enter a raw pattern or paste JavaScript literal syntax such as /hello/gi. Literal flags are combined with the selected options.

Results will appear here.

Example

/hello/gi

Test text:

Hello hello

Result:

2 matches found at indexes 0 and 6

How to use

  1. Enter a raw pattern such as \d+, or paste a JavaScript regex literal such as /hello/gi.
  2. Select the flags you need. Global is enabled by default so every match is returned.
  3. Paste or type the text to test.
  4. Click “Test Regex” or press Ctrl/Command + Enter to see each match, its index and any capture groups.

The result displays at most the first 1,000 matches. Testing runs away from the page interface and stops after 1.5 seconds, so an accidental expensive pattern cannot leave the tab permanently frozen.

Common use cases

Regex Tester is useful for checking JavaScript validation patterns, matching IDs in logs, extracting text fragments and debugging capture groups before shipping code. The result includes each match and its zero-based index so you can verify where the expression matched.

Use it for quick browser, Node.js and TypeScript regex checks when you need to confirm exact JavaScript behavior. Paste a raw pattern or a literal like /[A-Z]+/gi, add sample text and verify the output before changing production code.

What is a Regex Tester?

A regex tester lets you run a regular expression against sample text before adding it to your code. This tester uses the browser's native JavaScript RegExp engine, so its syntax and behavior match modern browser, Node.js and TypeScript projects.

Flags change how the same pattern behaves. Use g to return every match, i to ignore letter case, m to make line anchors work per line, s to let a dot match newline characters and u for Unicode-aware parsing.

For example, /hello/gi finds both “Hello” and “hello”. If a pattern is invalid, the tool shows the JavaScript error so you can correct it. All testing happens locally in your browser.

FAQ

What is a regex tester?
It runs a regular expression against sample text and reports the matches, positions and capture groups so you can debug a pattern before using it in code.

Is this regex tester compatible with JavaScript?
Yes. It is designed around JavaScript RegExp behavior, which makes it useful for browser code, Node.js and TypeScript projects.

What regex flags are supported?
The tool supports global (g), case-insensitive (i), multiline (m), dotAll (s) and Unicode (u). You can combine them or paste them in JavaScript literal syntax.

Learn with a practical guide

If you are not sure how to test a JavaScript pattern safely, read the step-by-step guide: How to test JavaScript regex patterns.

Related tools

🔄 Regex Replace 📋 Regex Cheatsheet 📧 Email Regex Generator