Regex Tester

Test a pattern against sample text, add flags, and review each match with its index.

Test regular expressions directly in your browser. Enter a regex pattern, optional flags, and sample text to see matches instantly.

Input Text

Paste sample text to test

0 characters 0 lines

Results

Matched values

0 characters 0 lines 0 matches

How it works

This regex tester builds a JavaScript regular expression from your pattern and flags, then runs it against the input text to show matches.

It is useful for testing validation patterns, extracting values, debugging text processing logic, and checking whether a regex behaves as expected before using it in code.

Common use cases

  • Test email or phone number patterns
  • Extract IDs, tokens, or numeric values
  • Check JavaScript regex behavior quickly
  • Debug matching rules before coding
  • Validate text parsing logic in the browser

Frequently asked questions

What does this regex tester do?

It lets you test regex patterns against sample text and view matches directly in your browser.

Can I use regex flags like g, i, and m?

Yes. You can enter common JavaScript regex flags such as g, i, and m.

Does this tool validate invalid regex patterns?

Yes. Invalid patterns show an error message instead of running the test.

How to use

Enter the pattern and flags, paste sample text, then inspect the matches.

  1. Type the regex pattern you want to test and add any optional flags.
  2. Paste the sample text you want to search.
  3. Click Test Regex to review each match, its index, and any errors.

Use cases

Use it when you want to prove a pattern works before you move it into code.

  • Test validation patterns against real sample strings.
  • Inspect matches from logs, exports, or copied text blocks.
  • Compare how different flags change the result before you ship a regex.

When this tool is useful

Test a pattern against sample text, add flags, and review each match with its index. Regex Tester sits in the developer formatting part of the site, which focuses on regex, escaping, diffing, and text prep for technical workflows.

Use it when you need a fast browser-side review pass for technical text, markup, diffs, escaping, or regex behavior. Within that group, it leans toward escaping & testing tasks, so the page is tuned for quick single-purpose use rather than a long multi-step workflow. If this step is only part of the job, the most relevant follow-up tools are Json Formatter and Base64 Encoder.

Before you copy the result

  • Verify the processed output against one realistic sample before trusting it for a bigger batch.
  • Look for escaped characters, dropped whitespace, or formatting changes that matter downstream.
  • If the output is close but not ready, move to a related formatting or review tool instead of patching by hand.

Example

A quick example of how this tool works.

Input

Pattern: \\d+\nText: Order 123 shipped on 2026-03-07

Output

Matches: 123, 2026, 03, 07