Skip to main content
Programming Language Tools

JS Regex Tester

Test a JavaScript regular expression against sample text and see matches, groups, and flags highlighted live.

Enter a pattern and flags, then paste sample text - this tool highlights every match and lists captured groups, using JavaScript's own RegExp engine.

/ /

This uses your browser's native JavaScript RegExp engine, so behavior exactly matches what your actual JS code will do.

What Does This Tool Do?

It runs your regular expression against sample text using JavaScript's built-in RegExp engine - the exact same regex engine your actual JavaScript code would use - and highlights matches plus any capture groups.

Why Use This Tool?

Regex patterns are notoriously easy to get subtly wrong - testing against real sample text before dropping a pattern into production code catches mistakes immediately, with visual feedback instead of trial-and-error in your actual application.

How to Use It

  1. Enter your regex pattern and any flags (g, i, m, s, etc.).
  2. Paste sample text to test against.
  3. Matches are highlighted, and any capture groups are listed below.

Common Errors

An invalid pattern (like unbalanced parentheses) throws a clear syntax error rather than silently matching nothing - if you see zero matches on text you expect to match, double-check your flags (especially the global g flag) and anchors.

Share this tool: