Skip to main content

Regex Tester

Test regular expressions against sample text with live match details.

Runs in your browser
Matches
4
  • Ada at index 0
  • Lovelace at index 4
  • Charles at index 43
  • Babbage at index 51

Use $1, $2 to insert captured groups.

About the Regex Tester

Regular expressions are quick to write and easy to get subtly wrong. This tester runs your pattern against sample text as you type, lists every match with its position, and shows the contents of each capture group so you can confirm the pattern does what you believe.

Flags are exposed individually, because the difference between a global, case-insensitive and multiline match is usually the reason a pattern behaves unexpectedly.

How to use the Regex Tester

  1. 1Type your pattern without the surrounding slashes.
  2. 2Toggle the flags you need, such as global, ignore case or multiline.
  3. 3Paste sample text into the test area.
  4. 4Review the match list, positions and capture groups.
  5. 5Optionally test a replacement string against the matches.

Features

  • Live matching as you type
  • Match index, position and length for every hit
  • Named and numbered capture group values
  • Individual flag toggles
  • Replacement preview with group references

Why people use it

  • Validate a pattern before putting it into production code.
  • Learn regular expressions by seeing results immediately.
  • Debug a pattern that matches too much or too little.

Common use cases

  • Checking an email or postcode validation pattern.
  • Extracting identifiers from a block of log text.
  • Testing a search and replace rule before applying it.

Privacy and your data

Patterns and sample text stay in your browser; nothing is sent to a server for evaluation.

Frequently asked questions