Regex Tester - Test JavaScript Regular Expressions Online

Write, debug, and inspect regular expressions using your browser native JavaScript RegExp engine. Toggle flags, preview matched spans highlighted in real time, and examine exact character indices and capture groups.

Regex Tester

How to use the Regex Tester

  1. 1Type your pattern into the JavaScript Regular Expression input box without leading or trailing slashes.
  2. 2Click any combination of the five flag buttons—g (global), i (ignore case), m (multiline), s (dotAll), and u (unicode)—to update matching behavior immediately.
  3. 3Paste or edit sample text inside the Test String textarea.
  4. 4Review the Live Highlighted Matches panel and the numbered breakdown table below, then click Copy Matches if you want to save matched offsets.

What the Regex Tester does

Regex Tester evaluates ECMAScript regular expressions locally via your browser JavaScript RegExp engine with safety guards and capture-group inspection:

  • Toggles standard JavaScript flags g, i, m, s, and u interactively and displays the total match count above the highlighted preview.
  • Highlights every matched range inline inside the Test String preview box so you can verify boundaries visually.
  • Displays a structured table of the first 50 matches listing match number (#), starting character Index, Full Match text, and numbered Capture Groups separated clearly.
  • Stops safely after 2,000 iterations and advances zero-length matches to avoid infinite browser loops, while displaying native syntax error messages when a pattern is invalid.

Example

Sample Pattern & Flags: (\w+)@([\w.-]+\.[a-z]{2,}) with flags g, i
Contact support@example.com or billing@test.org for help.
Detected matches
Match #1 (index 8): "support@example.com" | Group 1: "support" | Group 2: "example.com"
Match #2 (index 31): "billing@test.org" | Group 1: "billing" | Group 2: "test.org"

Both email addresses highlight inline inside Live Highlighted Matches while Capture Groups split each local part and domain automatically.

Frequently asked questions

Which regular expression flavor does Regex Tester use?

It runs directly on your browser native JavaScript (ECMAScript) regular expression engine, making results match Chrome, Firefox, Safari, and Node.js behavior.

What do the g, i, and m flags do?

g (global) finds every match in the text instead of stopping at the first one. i (case-insensitive) ignores uppercase/lowercase differences. m (multiline) lets ^ and $ match the start and end of each line.

How do capture groups work in the match details?

Wrapping part of your pattern in parentheses like (\w+) creates a numbered capture group ($1, $2, and so on). Each match row lists every captured group substring alongside its character start index.

What happens if I type an invalid regex syntax?

The tester catches RegExp syntax errors immediately and displays an inline error message describing the problem (such as an unterminated group) without crashing the page.

Related tools

View All Tools