Regex Tester

Test regular expressions with live highlighting and match details.

Presets:
//

About This Tool

Test and debug regular expressions with live syntax highlighting. See every match with its position, use common presets for emails, URLs, and phone numbers, and test replacements with capture group references.

This regex tester uses JavaScript regex syntax. All processing happens in your browser — nothing is sent to any server.

Frequently Asked Questions

Which regex flavor does this use?

This tool uses JavaScript (ECMAScript) regular expressions, which are supported by all modern browsers, Node.js, and many other languages.

What do the flags mean?

g = find all matches (not just the first), i = case-insensitive, m = treat ^ and $ as line boundaries, s = make . match newlines too.

How do I use capture groups in replacements?

Use $1, $2, etc. to reference captured groups. Named groups use $<name>. $& inserts the entire match. $` and $' insert text before/after the match.

How to Use the Regex Tester

Enter your regular expression pattern and test string. Matches are highlighted in real time as you type. Toggle flags (global, case-insensitive, multiline) and use the replace mode to test substitution patterns. The presets library provides common patterns for emails, URLs, phone numbers, and more.

Why Test Regular Expressions

Regular expressions are powerful but notoriously difficult to get right. A small mistake in a regex pattern can match too much, too little, or cause catastrophic backtracking that freezes your application. Testing patterns with real data before putting them in code prevents bugs, data loss, and performance issues.

This tester highlights every match in context, shows capture groups, and counts total matches — giving you confidence that your pattern does exactly what you intend before you deploy it.

Common Use Cases

  • Developers building and debugging regex patterns for validation
  • Data engineers writing patterns for log parsing and extraction
  • QA testers verifying input validation regex in forms
  • SEO specialists writing redirect rules with regex
  • System administrators writing grep and sed patterns
Pro Tip

After extracting data with regex, clean it up with Remove Duplicate Lines.