TextyConverterbeta
⌘K

Regex Tester

Test a JavaScript regular expression against sample text. See matches, capture groups, and counts.

3 matches
3 cats, 12 dogs, 100 birds
#IndexMatchGroups
103
2812
317100

About Regex Tester

Type a regex, paste some text, and instantly see every match along with its capture groups and position. The tester uses JavaScript's regex engine, so anything you write here will behave the same in your code. Common flags (g, i, m, s, u) are configurable; invalid regex surfaces with a descriptive error.

When to use it

  • Iterating on a regex pattern before pasting it into code
  • Verifying that a pattern matches the inputs you expect
  • Debugging why a regex isn't catching a specific case
  • Inspecting capture groups in a complex pattern

How it works

The pattern is compiled with new RegExp(pattern, flags). Each match is collected via matchAll (or exec for non-global patterns) along with index, full match string, and capture groups. Match counts are displayed live; the matched ranges are highlighted in the test text.

Examples

Pattern: (\d+) Flags: g
Text: "3 cats, 12 dogs"
Matches: 2
[0] '3' at 0
[1] '12' at 8

Frequently asked questions

What regex flavor is supported?
JavaScript (ECMAScript) regex via new RegExp(). Lookbehinds (ES2018), named groups, Unicode property escapes (with the u flag) — all supported. PCRE-only features like possessive quantifiers or balancing groups are not.
What flags are available?
g (global, find all), i (case-insensitive), m (multi-line ^ and $), s (. matches newlines), u (Unicode-aware), y (sticky). Combine them in any order: 'gim'.
Can a regex hang the page?
Theoretically yes — catastrophic backtracking on a pathological pattern can lock up the JavaScript engine. If the page freezes, refresh and write a more constrained pattern.

Related tools