Regex Tester

Regex Tester

Test patterns and inspect match locations. Use this online tool instantly.

Input

Matches

About The Regex Tester

This free online Regex Tester runs JavaScript regular expressions against sample text in your browser. It is useful for checking extraction patterns, log filters, validation rules, capture groups, and named groups before using a pattern in code.

The result lists each match with its index, length, full matched text, numbered capture groups, and named capture groups when the pattern uses them. Invalid patterns or invalid flags are reported without keeping stale output.

How to Test Regex Online

  1. Enter a regular expression in Pattern without wrapping slashes.
  2. Enter JavaScript regex flags such as g, i, or m.
  3. Paste realistic sample text into Text.
  4. Click Run Regex to inspect matches and capture groups.
  5. Use Load sample to test a realistic support-ticket snippet.

Choosing Options Correctly

Flags:
- Use g to return every match instead of the first match only.
- Add i for case-insensitive matching.
- Add m when ^ and $ should work per line.

Common Use Cases

  • Extract order IDs, ticket IDs, dates, emails, or error codes from copied text.
  • Check capture groups before using a regex in JavaScript.
  • Debug why a validation pattern matches too much or too little.
  • Test log-search patterns against a small sanitized sample.

Quick FAQ

Is my test text uploaded?
No. Regex testing is designed to run in the browser.

Should I include slashes around the pattern?
Usually enter the pattern itself and set flags separately unless the tool explicitly supports slash notation.

Why do results differ from another programming language?
Regex syntax and features differ between JavaScript, Python, PCRE, Java, and other engines.

What should I avoid pasting?
Avoid secrets, tokens, production logs, or personal data when testing patterns.