Processed entirely in your browser. Your input is not uploaded.

Regex Tester

Test regular expressions live: see every match with index and capture groups, toggle flags, and preview find-and-replace output safely.

Last updated November 12, 2026

Loading tool workspace…

Overview

Test, debug, and preview regular expressions (RegEx) interactively against sample text. This tool provides real-time match highlighting, index offsets, numbered and named capture groups, flag toggling (g, i, m, s, u), live find-and-replace preview with backreferences, and built-in ReDoS (Regular Expression Denial of Service) protection against catastrophic backtracking.

Engineered for software developers, data engineers, QA testers, and technical writers who need to validate pattern matches safely in their browser.

How it works

The tester evaluates the regular expression against your target text using JavaScript's native RegExp engine:

• Syntax Components: - Metacharacters: . (any char), ^ (start of line/string), $ (end of line/string), \b (word boundary). - Character Classes: \d (digit [0-9]), \w (alphanumeric + underscore), \s (whitespace), [^abc] (negated class). - Quantifiers: * (0 or more), + (1 or more), ? (0 or 1), {min,max} (range), +? / *? (lazy/non-greedy). - Groups: (...) (capturing group), (?:...) (non-capturing group), (?<name>...) (named capture group). • Flags: - g (global): Finds all matches across the input rather than halting at the first match. - i (ignore case): Makes case insensitive (A matches a). - m (multiline): Treats ^ and $ as matching the start and end of every newline. - s (dotAll): Allows . to match newline characters (\n). - u (unicode): Enables full Unicode code-point matching. • Safe Replacement: - In replace mode, use $1, $2 to reference positional capture groups, $<name> for named groups, and $& for the full match string. • ReDoS Protection: - Pathological expressions containing nested quantifiers (e.g. (a+)+$) exhibit exponential execution time on non-matching inputs, which can freeze the browser thread. The tool scans for dangerous backtracking patterns and bounds input evaluation to 20,000 characters.

How to use the Regex Tester

1

Enter a Pattern

Type the expression between the slashes, e.g. \b\w+@\w+\.\w+\b.

2

Toggle Flags

Switch on g for all matches, i for case-insensitive, m, s or u as needed.

3

Paste Your Text

Matches appear instantly with their index and any capture groups.

4

Preview a Replacement

Add a replacement string using $1, $& or $&lt;name&gt; and copy the result.

When to use it

  • Developing and testing validation patterns for emails, phone numbers, postal codes, and URLs before embedding in application source code.
  • Extracting specific tokens, dates, and ID strings from log files, CSV exports, or HTML source using capture groups.
  • Previewing bulk text find-and-replace transformations using $1 / $2 backreferences.
  • Debugging multiline markdown and code syntax highlighting rules.

Examples

Email Address Pattern Matching

Input
Pattern: \b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b
Flags: gi
Text: Contact support@taskkit.in or sales@company.org for assistance.
Output
Match 1: support@taskkit.in (Index: 8-26)
Match 2: sales@company.org (Index: 30-47)

Identifies valid email address patterns and isolates start and end index boundaries.

Capture Groups & Date Reformatting

Input
Pattern: (\d{4})-(\d{2})-(\d{2})
Replacement: $3/$2/$1
Text: Published on 2026-11-12
Output
Matches: 2026-11-12 (Group 1: 2026, Group 2: 11, Group 3: 12)
Replaced Text: Published on 12/11/2026

Rearranges ISO YYYY-MM-DD date components into DD/MM/YYYY format using capture backreferences.

Named Capture Groups

Input
Pattern: (?<area>\d{3})-(?<prefix>\d{3})-(?<line>\d{4})
Text: Call 415-555-0199
Output
Match: 415-555-0199
Named Groups: area=415, prefix=555, line=0199

Extracts structured sub-components directly accessible by key name.

Key Features & Accuracy

Match Breakdown

Every match with its character index, plus each capture group by name or number.

Live Replacement

Preview find-and-replace output with backreference support before committing.

ReDoS Warnings

Flags dangerous nested-quantifier patterns that can freeze a browser.

Bounded Work

Input and match counts are capped so a pathological pattern cannot lock the tab.

Limitations & important notes

Evaluation is capped at 20,000 characters and 500 matches to protect device responsiveness and prevent tab crashes.
The tester executes JavaScript's ECMAScript regex engine; syntax specific to other engines (such as PCRE lookbehinds, Python regex flags, or POSIX classes like [:digit:]) may behave differently.
Patterns with excessive lookarounds or nested unbounded repetition may trigger safety warnings.

Frequently Asked Questions

g finds every match, i ignores case, m lets ^ and $ match each line, s lets . match newlines, and u enables full Unicode mode.