Skip to main content

Regex tester

Test a JavaScript regular expression with flags against sample text and see each match, its index and capture groups. Runs in your browser.

  • Hello at 0
  • Ada at 7
  • Lovelace at 11

JavaScript RegExp in your browser only.

Test a regular expression against sample text and see every match, its position and its capture groups. The tester uses your browser’s JavaScript RegExp engine, so results match what your JavaScript or TypeScript code will do.

How to use

  1. Type a pattern without the surrounding slashes, for example (\w+)@(\w+)\.com.
  2. Set flags: g (all matches), i (ignore case), m (multiline), s (dot matches newlines), u (Unicode).
  3. Paste your test string.
  4. The match list updates as you type: each match shows the matched text, its index and any captured groups. Invalid patterns show the browser’s error message.

Tips

  • Without the g flag, only the first match is listed.
  • Other engines (PCRE, Python re, Java) differ in some features, such as lookbehind support and named-group syntax, so re-test there if your code is not JavaScript.
  • Keep samples small when testing patterns with nested quantifiers, which can backtrack heavily.

Text diff checker · Cron expression generator · JSON formatter

How we check

Checked against the tool’s unit tests and a manual run in a desktop browser on 2026-11-13 (Asia/Colombo). Corrections: [email protected].

More free tools