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.

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 [email protected] today.

Output

Matches: ["[email protected]"]

FAQ: FAQ

  • Which regex engine (flavor) runs the test?

    Patterns are evaluated with the browser’s JavaScript (ECMAScript) RegExp, so behavior can differ from PHP or Python (PCRE-style). For instance, lookbehind support varies and PCRE-only features such as \K or possessive quantifiers are not available. If your server uses another language, confirm in that environment too.
  • What do the g / i / m / s / u flags mean?

    g is global search (find all matches, not just the first), i ignores case, m is multiline (^ and $ match at the start and end of each line), s makes the dot match newlines (dotall), and u enables Unicode mode. You can combine the flags you need.
  • A quantifier is too "greedy" and matches more than I want — what can I do?

    By default * and + match greedily (as much as possible). Add a ? to make them lazy (as little as possible): *? or +?. For example, <.*> matches a whole line while <.*?> matches just the first tag — handy when extracting only part of HTML or a log line.

Use cases: Common use cases

  • Iterating on search patterns

    Test regexes against sample text to tune matches for replace or extraction logic.

  • Creating shareable examples

    Keep patterns alongside test strings so reviews and questions convey intent clearly.

  • Sanity-checking performance

    Vary input sizes to spot catastrophic backtracking issues before shipping.

Notes: Notes & limitations

  • Work stays in your browser

    Inputs and outputs remain local. Closing the tab or clearing cache will remove any temporary state.

  • Validate critical data

    Results are helper outputs—double-check them before sending to production systems or sharing externally.

  • Large payloads depend on your device

    Very large text or files can feel slow in some browsers. Use a desktop environment for heavy workloads.

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

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

Use Case
2026-08-07

curl Options Cheat Sheet: What -X, -H and -d Actually Do

A reference for the curl options you meet in real API work: why -d already implies POST, how -d differs from --data-raw, the @ prefix that silently reads a file, single vs double quotes, and why -k and -L deserve more caution than they usually get.

Introduction
2026-08-06

Converting Between JSON Schema and Zod: How required Maps to .optional()

Inside a two-way converter that turns JSON Schema into a Zod schema and Zod code back into JSON Schema. Covers the inverted defaults between required and .optional(), the constraint mapping table, and how the Zod side is parsed without executing any code.

Use Case
2026-08-06

SQL Clause Order Reference: Why WHERE Can't See Your SELECT Alias

The order you write SQL clauses is not the order the database runs them. A reference for the logical execution order (FROM → WHERE → GROUP BY → HAVING → SELECT → ORDER BY → LIMIT), why aliases fail in WHERE, when to use WHERE vs HAVING, and the MySQL/PostgreSQL differences that bite.

Use Case
2026-08-06

Unified Diff Format Reference: Reading @@ Hunks in git diff Output

How to read the unified diff format git produces: what the four numbers in @@ -12,7 +12,9 @@ mean, why a one-character edit shows as a whole-line replacement, the whitespace and line-ending traps, \ No newline at end of file, combined @@@ diffs on merges, and rename detection via similarity index.

Use Case
2026-08-06

UTC to JST Reference: The 9-Hour Offset, Cheat Sheet & Timezone Pitfalls

Convert between UTC and JST (Japan Standard Time) with a cheat sheet. Covers what Z and +09:00 mean in ISO 8601, when JavaScript date parsing silently shifts by 9 hours, MySQL/PostgreSQL timezone behavior, and why GitHub Actions cron always runs in UTC.

Use Case
2026-08-04

CREATE TABLE Reference: MySQL vs PostgreSQL vs SQLite Types & Constraints

A cross-database CREATE TABLE (DDL) reference with cheat sheets for data types, auto-increment keys (AUTO_INCREMENT / IDENTITY / rowid), foreign key ON DELETE behavior, and the CHECK constraint that MySQL silently ignores.

Ad

Ad