Regex Tester
Test and debug regular expressions with live match highlighting

How to Use This Tool

  1. Enter your regular expression pattern in the "Pattern" field (without surrounding slashes).
  2. Toggle the desired flags using the buttons: g (global), i (case-insensitive), m (multiline), s (dotAll).
  3. Type or paste your test string into the "Test String" textarea.
  4. All matches are highlighted in yellow in real time, and the match list below shows each match with its start index.

Common Use Cases

  • Validating that an email, phone number, or postcode input matches the expected format.
  • Writing patterns for log parsing to extract specific fields from server log lines.
  • Testing find-and-replace patterns before running them in a code editor like VS Code.
  • Learning how named capture groups and lookaheads behave with different input strings.
  • Debugging a regex that works in one environment but fails in another by isolating the test case.

Frequently Asked Questions

What regex syntax is supported?

The tester uses JavaScript's native RegExp engine, which supports character classes, quantifiers, anchors, groups, backreferences, lookahead, lookbehind, named capture groups, and Unicode property escapes (\p{...}).

Why is the "g" flag always on?

The tool enforces the global flag internally to find all matches in the string. You can add it explicitly or leave it out — the result is the same. Toggling the "g" button changes whether it appears in the flags display.

What does the "s" (dotAll) flag do?

By default, the dot (.) metacharacter matches any character except newlines. The "s" flag makes the dot match newlines too, which is useful when your test string spans multiple lines.

What are named capture groups?

Named capture groups use the syntax (?<name>...) to assign a label to a captured group. The tester displays all named groups and their captured values in a dedicated section below the match list.

Related Tools

JSON Formatter

Format and validate JSON instantly

Use Tool

Base64 Encoder

Encode and decode Base64 strings

Use Tool

URL Encoder

Encode and decode URLs

Use Tool