Regex Tester

/ /

What is Regex Tester

A regular expression (regex) is a sequence of characters that defines a search pattern for matching text. This online regex tester lets you write a pattern, choose flags (global, case-insensitive, multiline, dotAll), and instantly see which parts of your test string match — with yellow highlights in the preview and a list of every match showing its character position and any captured groups.

How to use

  1. Type your regular expression in the pattern field between the / delimiters.
  2. Toggle the flags you need: g (find all matches), i (case-insensitive), m (multiline ^ and $), s (dot matches newlines).
  3. Type or paste the text you want to search in the Test String area.
  4. See matches highlighted in the preview and listed below with index positions and captured group values.
  5. Click Clear to reset both fields and start over.

When to use it

Building a route validator for URLs like /users/123 or /products/abc-456? Type \/(\w+)\/(\w[\w-]*) in the pattern field, turn on the g flag, and paste a list of API paths in the test box. You instantly see which paths match and what the two captured segments (resource type and ID) are, all without writing a single line of code.

Frequently asked questions

What flags are available?

Four flags are supported: g (global — find all matches, not just the first), i (case-insensitive matching), m (multiline — ^ and $ match start/end of each line), and s (dotAll — the dot . matches newline characters too).

How do I test capture groups?

Put parentheses around the part you want to capture: (\d+) captures one or more digits. Each match in the list shows the captured group values labelled Group 1, Group 2, etc. Named groups like (?<year>\d{4}) are also supported.

Why does my pattern cause an error?

Common causes: unescaped special characters (use \. instead of . to match a literal dot), unclosed parentheses or brackets, or invalid flag combinations. The error message below the pattern field describes the issue.

Is the g flag required to find all matches?

Yes. Without g, the regex stops after the first match. Enable g to find every occurrence in the test string.

Are my patterns and text sent to a server?

No. All processing runs entirely in your browser using the built-in JavaScript RegExp engine. Nothing leaves your device.

Can I share this tool with my inputs pre-filled?

Yes. The URL updates automatically as you type. Copy it from the address bar or use the Share button — anyone who opens the link will see your exact inputs ready to go.

Related tools

Latest posts