All tools
Developer

Regex Tester

Test a regular expression against text, with matches highlighted.

🔒 Runs entirely in your browser — nothing here is ever uploaded

About the Regex Tester

Tests a regular expression against sample text, highlighting every match directly in the text, using your browser's native, standards-compliant regex engine.

How to use it
  1. Enter a Pattern (without the surrounding slashes).
  2. Toggle the Flags you need — g for all matches, i for case-insensitive, m for multiline anchors, s for dotAll.
  3. Enter or paste your Test text.
  4. Read the match count and see every match highlighted in the text below.
Formula
Uses JavaScript's built-in RegExp engine (ECMA-262) directly — the same regex dialect and matching behavior your pattern would have in actual browser or Node.js code, not a separate simplified implementation.
Worked example

The pattern \b[\w.+-]+@[\w-]+\.[a-zA-Z]{2,}\b with the g and i flags finds every email-like substring in a block of text, highlighting each one in place.

Recommendations
  • Without the g (global) flag, only the first match is found — turn it on whenever you expect (or want to check for) more than one match.
  • The m (multiline) flag changes what ^ and $ mean — they match the start/end of each line instead of the start/end of the whole string, which matters for multi-line test text.
  • An invalid pattern (unbalanced parentheses, a bad escape sequence) shows a real JavaScript regex error message — the exact error your own code would throw if you used that pattern directly.
Frequently asked questions
Yes — it runs JavaScript's native RegExp directly in your browser, so a pattern that works here will behave identically in actual JavaScript or Node.js code. Other languages (Python, PCRE, etc.) have their own regex dialects with some differences.