UtilityBase logoUtilityBase

Developer Tools

Regex Tester

Test regular expressions live with match highlighting, groups, and a cheat sheet.

Updated July 8, 2026

How to use the regex tester

  1. 1Type your pattern — matches highlight in the test string live.
  2. 2Toggle flags: i for case-insensitive, m if you're anchoring per line.
  3. 3Paste realistic test text, including strings that should NOT match.
  4. 4Check the group table to confirm captures extract exactly what you expect.

Common uses

  • Building and debugging a pattern before it goes into code
  • Testing validation regexes (emails, dates, IDs) against edge cases
  • Working out extraction patterns for logs or scraped text
  • Learning regex interactively with instant visual feedback

Frequently asked questions

Which regex flavor does this use?

JavaScript's built-in RegExp — identical to what runs in Node, browsers, and most web tooling. If your pattern is destined for Python, Go, or PCRE, the core syntax carries over but a few features differ (lookbehind support varies, named-group syntax differs), so verify edge cases in the target language.

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

g (global) finds all matches instead of stopping at the first; i ignores case; m makes ^ and $ match at every line break instead of only the string's ends; s makes the dot match newlines too. This tester always searches globally for display purposes and shows your chosen flags in the pattern readout.

Why does my pattern match too much?

Usually greedy quantifiers: .* grabs as much as possible, so <.*> swallows from the first < to the last >. Make it lazy with .*? or, better, use a negated class like <[^>]*> which can't cross a closing bracket. The live highlighting makes this instantly visible.

What are capture groups?

Parentheses capture the text they match into numbered groups ($1, $2…) for extraction or replacement. The results table shows each match's groups separately. Use (?:…) when you need grouping for alternation or quantifiers but don't want a capture.

About this tool

The regex tester runs your pattern against test text as you type, highlighting every match inline and breaking out capture groups per match in a results table. Flags toggle with one click (global, ignore case, multiline, dotall), invalid patterns show the engine's actual error message instead of failing silently, and zero-length-match infinite loops are guarded against. It uses JavaScript's native RegExp engine, so behavior matches Node and browsers exactly — what you test is what ships. A built-in cheat sheet covers the fourteen constructs that make up 95% of real-world patterns, from character classes to boundaries to non-capturing groups.

Like everything on UtilityBase, the regex tester runs entirely in your browser — nothing you enter is uploaded or stored on a server. It's free to use with no account required. Browse more developer tools here.

Was this tool helpful?

Related tools