|
Developer Utilities 100% Client-Side · 0 Bytes Sent to Server Instant In-Memory Execution

Regular Expression (Regex) Tester

Live JavaScript regex tester supporting global (g), case-insensitive (i), multiline (m), and dotAll (s) flags with detailed match breakdowns and capture group inspection.

Real-time Regular Expression (Regex) Tester & Group Extractor
//gi
Flags:
Test Text String2 Matches Found
Extracted Matches & Capture Groups
Match #1: "[email protected]"Index: 28
Group 1: userGroup 2: example.com
Match #2: "[email protected]"Index: 56
Group 1: adminGroup 2: example.com

Step-by-Step Instructions

1

Enter Regular Expression Pattern

Input your RegEx pattern with opening and closing delimiters (e.g., `/[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/`).

2

Select RegEx Flags

Toggle Global (`g`), Case-Insensitive (`i`), Multiline (`m`), DotAll (`s`), and Unicode (`u`) flags.

3

Input Test String

Paste sample text, log lines, or code to test pattern matches against.

4

Review Matches & Capture Groups

Examine highlighted real-time matches, capture groups (`$1`, `$2`), named groups, and match index offsets.

Key Features & Capabilities

  • Real-time ECMAScript / JavaScript regular expression evaluation engine
  • Match inspector showing full matches, numbered capture groups, named capture groups, and character index positions
  • RegEx syntax colorizer and token explainer breaking down character classes, quantifiers, lookaheads, and lookbehinds
  • RegEx Replace preview demonstrating substitution strings using capture groups and custom replacement functions

Frequently Asked Questions

What do the standard RegEx flags (g, i, m, s, u) do?

**g (Global)**: finds all matches rather than stopping after the first match; **i (Case-Insensitive)**: matches upper and lowercase letters identically; **m (Multiline)**: causes `^` and `$` to match the start/end of each line rather than the entire string; **s (DotAll)**: allows `.` to match newline characters (`\n`); **u (Unicode)**: enables full UTF-16 code point matching.

What is the difference between greedy and lazy (non-greedy) quantifiers?

A **greedy quantifier** (`*`, `+`, `{n,}`) matches as many characters as possible. A **lazy quantifier** (created by appending `?`, e.g., `*?`, `+?`) matches the minimum number of characters required to satisfy the pattern. For example, matching `<.*>` against `<div>hello</div>` matches the entire string (greedy), while `<.*?>` matches only `<div>` (lazy).

What are Lookahead and Lookbehind assertions in RegEx?

Lookarounds match text without consuming characters: 1) **Positive Lookahead** `(?=...)`: matches only if followed by `...`; 2) **Negative Lookahead** `(?!...)`: matches only if NOT followed by `...`; 3) **Positive Lookbehind** `(?<=...)`: matches only if preceded by `...`; 4) **Negative Lookbehind** `(?<!...)`: matches only if NOT preceded by `...`.

What is catastrophic backtracking in Regular Expressions?

Catastrophic backtracking occurs when nested quantifiers (e.g., `(a+)+$`) attempt to match non-matching strings, causing the regex engine to evaluate exponential ($O(2^n)$) combinations, locking the CPU. Avoiding overlapping nested quantifiers prevents ReDoS (Regular Expression Denial of Service) vulnerabilities.

Discover complementary online tools in the same workflow.