Regex Tester

Test regular expressions, capture groups, and replacement output in real time.

Shortcuts: Ctrl/Cmd+Enter (Sample), Ctrl/Cmd+Shift+C (Copy Matches), Ctrl/Cmd+S (Download)
No matches found.

How to Use

  1. 1

    Enter pattern and flags.

  2. 2

    Paste your target text.

  3. 3

    Review matches and optional replacement result.

Features

  • Match index and value listing
  • Capture group visualization
  • Replacement preview
  • Copy match summary

FAQ

Q. Can I test without global flag?

A. Yes. Without g, only the first match is evaluated.

Q. Which flags are supported?

A. It follows browser JavaScript RegExp support for standard flags.

Technical Notes

The tool builds RegExp dynamically and uses matchAll for global extraction.

Replacement preview is generated with text.replace using the same pattern.

Security & Privacy

All text and regex processing stays in your browser.

No external API calls are used for matching logic.

Examples, Validation Cautions, and Common Mistakes

Examples

  • Test patterns for email addresses, postal codes, URLs, and form validation.
  • Extract error codes or timestamps from logs with a sample regex.
  • Check what will match before using a pattern for replacement.

Cautions

  • Regex syntax differs by runtime, so confirm the final pattern in the target language too.
  • Overly broad patterns can match more text than intended.
  • Complex repetition can become slow on certain inputs.

Common Mistakes

  • Testing with too few samples and missing production edge cases.
  • Overusing `.*` and capturing much more than intended.
  • Forgetting `^` or `$` and mistaking partial matches for full matches.