Free Tool

Regex Tester

Test regular expressions with live match highlighting. Supports all standard flags, shows match positions, values, and capture groups — free, no sign-up, runs in your browser.

Regular Expression Tester

//g
Flags:

What is a regex tester?

A regular expression is a pattern that describes a set of strings. Common elements: . matches any character, \d matches digits, + means one or more, * means zero or more, and ^/$ anchor to start and end of a line.

Flags

The g flag finds all matches (not just the first). i makes matching case-insensitive. m makes ^ and $ match line starts and ends. s makes . match newlines.

Greedy vs lazy

Quantifiers like + and * are greedy by default — they match as much as possible. Adding ? makes them lazy: +? matches as little as possible. This matters when matching between delimiters.

How to use

  1. Enter your regular expression in the pattern field.
  2. Select any flags you need — g (global), i (case-insensitive), m (multiline), or s (dotall).
  3. Paste your test string in the input area. Matches are highlighted live and listed below with their index and captured groups.

Examples

  • Simple: Pattern \d+ with flag g against "order 42 has 3 items" → two matches: 42 at index 6 and 3 at index 15.
  • Developer workflow: Validate email format with ^[\w.-]+@[\w.-]+\.\w{ 2,}$. Test edge cases like [email protected] (should match) and user@domain (should not) before adding the pattern to your validator.
  • Edge case: .* in <tag>content</tag> is greedy and matches the entire string from the first < to the last >. Use .*? to match lazily between the nearest delimiters instead.

Frequently Asked Questions

What is a regular expression?
A regular expression (regex) is a sequence of characters that defines a search pattern. Used in programming and text processing to find, match, and manipulate strings. They are supported in nearly every programming language.
What do regex flags do?
Flags modify how a regex pattern is applied: g (global) finds all matches instead of just the first; i (case-insensitive) matches regardless of letter case; m (multiline) makes ^ and $ match line boundaries; s (dotall) makes the dot . match newlines too.
How do I match capture groups in regex?
Use parentheses to create capture groups: (\d+) captures one or more digits. This tool shows each capture group value in the match details. Named groups use (?<name>pattern) syntax.
What regex engine does this use?
This tool uses the JavaScript built-in RegExp engine, which implements a subset of PCRE-style regex syntax. It supports lookahead, lookbehind (in modern browsers), named groups, and most standard regex features.