Regular Expression

Match, capture, and replace text

Loading tool…

About Regular Expression Tester

Regular Expression Tester checks matches, capture groups, flags, and replacement behavior against text you provide.

A pattern is easier to trust when its test set includes expected matches, near-misses, Unicode, line breaks, and empty input. The tester is most useful as a small reproducible case for a regex that will later live in application code.

How to use this developer tool

  1. Enter the expression, flags, and representative test text.
  2. Review full matches and capture groups, then add cases that should not match.
  3. Try the replacement operation only after the match boundaries are correct, and keep the test examples with the expression.

Privacy and data handling

Regular-expression matching runs in the browser. Avoid pasting personal records or log files containing secrets; use short representative samples instead.

Related developer tools

Frequently asked questions

Why does a flag change the result?

Flags can change case sensitivity, line boundaries, Unicode behavior, or whether matching continues after the first result. Test them deliberately.

Can a regex validate an entire document?

It can check a pattern, but a regex is not always the right parser for nested or structured formats such as JSON, XML, or programming languages.

What is a near-miss test?

It is an input that looks close to a valid match but should be rejected. Near-misses reveal missing boundaries and overly broad quantifiers.