WizzyTools

Test a regular expression online

Works offline · never uploaded

Test a JavaScript regular expression against sample text and see every match highlighted live.

Updated

/ 5 - Be the first to rate this tool Thanks for rating!

Verification failed - please try again.

/ /

How it works

  1. 1

    Enter your pattern and any flags.

  2. 2

    Paste sample text into the test string box.

  3. 3

    Check the highlighted matches and the match list.

  4. 4

    Refine the pattern until only the right text matches.

About the Regex Tester

Regular expressions are compact and easy to get subtly wrong, and testing one inside your application means a slow edit-and-run loop. This tester runs your pattern against sample text with the browser's own JavaScript regex engine, highlights every match in place and lists each one with its position, so you can adjust the pattern and see the effect straight away.

What you can do

  • Type a pattern between the slashes and flags such as i, m, s, u or y after them.
  • See every match highlighted in the preview of your test string.
  • Read a numbered list of matches with the character index where each one starts.
  • Get the engine's error message when a pattern is invalid, such as an unterminated group.
  • Press Share link to send someone the pattern, flags and test text in one URL.

When it works best

  • Checking that a validation pattern for emails, postcodes or order numbers accepts the right inputs and rejects the wrong ones.
  • Building a pattern to pull IDs or timestamps out of log lines.
  • Debugging why a search-and-replace in your editor matches too much or too little.

Things to know

  • Matching runs in your browser. Shared links contain the test text, so remove anything private before sharing.
  • The global flag is always added so that every match is found.
  • This uses JavaScript regex syntax. Features from PCRE or Python, such as possessive quantifiers or inline (?i) modifiers, may not work the same way.
  • Capture groups are not shown separately and there is no replace preview. To check a whole JSON document rather than a string, use the JSON Schema Validator.

Frequently asked questions

JavaScript. PCRE or Python features such as possessive quantifiers or inline (?i) may behave differently.

It is added automatically so every match is found and listed.

No. Matches are highlighted and listed with their positions, but groups and replace previews are not shown.

The pattern, flags and test text, so remove private data first.