Skip to content
Text Utilities

Regex Tester

Test and validate regular expressions by entering a pattern, flags, and sample text.
The tester highlights matches, displays the number of hits, and shows captured groups
to help you understand how your regular expression behaves.

You can freely combine flags such as global, case-insensitive, or multiline, and instantly see the results reflected in the output.
Syntax errors are detected immediately and shown as clear error messages, making it easier to debug and refine complex patterns.

This tool is useful for developers, data analysts, and anyone working with text processing, log analysis, form validation, or search patterns.
All testing is performed locally in your browser, and no input text or patterns
are sent to any server, allowing safe and private experimentation.

Results
Enter a pattern and text, then click “Run test”.

Matches in the text

Matches are highlighted in the test text.

What this pattern means

Read left to right. Descriptions are a guide for common syntax.

    Enter a pattern to see its explanation.

    Code for this pattern

    Test cases

    Write one case per line to check the pattern above. A line starting with “- ” must not match; “+ ” (or no prefix) must match. The result shows which cases pass.

      Guide

      How to use & features

      • Enter the pattern and flags at the top, then paste the target text into the input area below.
      • Matched portions are highlighted, and capture group values are shown for inspection.
      • Type a replacement string to see the output update in real time.
      • All processing runs locally, so your text is never sent anywhere.
      Samples

      Sample input & output

      Find email addresses

      Input
      Pattern: /[\w.-]+@[\w.-]+/g
      Text: Contact us at support@example.com today.
      Output
      Matches: ["support@example.com"]
      FAQ

      FAQ

      • Which regex engine is it?

        Your browser's JavaScript (ECMAScript) `RegExp`. Some syntax differs from PCRE, Python or Java. Test in the language you will actually use before relying on it.
      • How do I set flags?

        Type letters such as `gim` in the flags field. `g` (all matches), `i` (ignore case), `m` (line-wise `^` and `$`), `s` (`.` also matches newlines) and `u` (Unicode) are available. Without `g`, only the first match is shown.
      • Are capture groups shown?

        Yes. Along with the position and text of each match, the contents of `(...)` groups and `(?<name>...)` named groups are shown per match.
      • Can it do replacements?

        No. It only shows the position, value and groups of matches; it does not build a replaced string.
      • What if the pattern is wrong?

        Regex syntax errors show the browser's own message, which helps you find a missing parenthesis or a bad escape.
      • Is my text sent anywhere?

        No. Matching all happens in your browser.
      Use cases

      Common use cases

      • Trying patterns to extract from logs and text

        Check on real text that a regex for IDs, dates or URLs in an error log matches as intended.
      • Checking form-validation patterns

        See which inputs a regex for email addresses, postal codes or phone numbers matches.
      • Checking a pattern before `grep` or an editor replace

        Before a bulk replace or search, confirm the pattern matches only the range you intend and avoid accidents.
      • Learning regular expressions

        See which part each group extracts, match by match, as you learn.
      Notes

      Notes & limitations

      • It is a JavaScript regex

        Inline flags such as `(?i)`, `\A` and `\Z`, possessive quantifiers (`a++`) and atomic groups are not available. Named groups are `(?<name>...)`, not Python's `(?P<name>...)`.
      • A heavy pattern can freeze the browser

        Nested quantifiers such as `(a+)+` can take a very long time on certain inputs (catastrophic backtracking). If it will not stop, close the tab.
      • `^` and `$` do not work per line by default

        Without the `m` flag they match only the start and end of the whole text. Likewise `.` does not match a newline without the `s` flag.
      • Add the `u` flag for Japanese and emoji

        Without `u`, characters such as emoji count as two, which can throw off `.` and length counts.
      About

      About this tool

      Regular Expression Tester

      Regular expressions are powerful for searching, validating, and extracting text, but complex patterns are hard to reason about without feedback. This regex tester lets you enter a pattern and sample text, then inspect matches, groups, and behavior while you iterate.

      Common use cases

      • Validate input patterns: Test patterns for emails, IDs, slugs, filenames, and log lines.
      • Extract structured data: Check capture groups before using a regex in scripts or backend code.
      • Debug replacements: Understand why a pattern matches too much, too little, or nothing at all.

      Regex review tip

      Be careful with overly broad patterns and catastrophic backtracking in production code. Test representative examples, including invalid inputs and edge cases, before relying on a pattern in a form, parser, or data pipeline.

      Articles for this tool

      Recent Articles