Skip to content

Regex Tester

Test regular expressions live with highlighted matches and capture groups.

LOCAL WORKSPACENO UPLOAD REQUIRED
//gi

About Regex Tester

Regular expressions are dense, and the fastest way to understand one is to watch it run. This tester compiles your pattern as you type, highlights every match in the sample text and breaks each match into its numbered and named capture groups.

It also includes a replacement preview, so you can confirm that a substitution using $1 style references produces exactly the output you expect before you paste it into your code.

How Regex Tester works in your browser

Patterns are compiled with the browser’s native RegExp and run against your test text with the flags you select. This matters more than it sounds: JavaScript’s regular expression dialect is not PCRE, and a pattern copied from a PHP, Python or Perl example may behave differently or fail to compile. Testing here tells you how the pattern will behave in JavaScript specifically, because it is literally the same engine.

Matches are collected with the global flag and each capture group is listed separately, including named groups from (?<name>...). An invalid pattern surfaces the engine’s own SyntaxError rather than a generic failure.

Regex evaluation runs in a disposable worker with a one-second timeout and a cancel button. The list displays at most 500 matches; that cap alone cannot prevent catastrophic backtracking. Text is limited to 200,000 characters and patterns or replacements to 10,000. Simplify nested quantifiers if execution times out.

When to use it

  • Building a validation pattern and seeing which of your real-world sample inputs it rejects.
  • Working out why a pattern that behaves correctly in Python does not match in JavaScript.
  • Extracting a specific field from log lines by iterating on the pattern against a genuine sample.
  • Testing against production log excerpts that should not be pasted into a hosted regex service.

Frequently asked questions

Why does my regex work elsewhere but not here?

JavaScript regular expressions are not PCRE. Patterns copied from PHP, Python or Perl examples can behave differently or fail to compile. This tester uses the browser engine, so it matches what runs in your code.

Which regex flavour is this?

JavaScript / ECMAScript regular expressions, exactly as they behave in the browser and in Node.js.

Why does my pattern seem to hang?

Certain nested quantifiers cause catastrophic backtracking. The tester terminates its worker after one second and caps displayed matches at 500. Simplify the pattern or shorten the input.

Can I use named capture groups?

Yes. Named groups are supported and are listed by name in the results.

Related tools