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.
Step-by-Step Instructions
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,}/`).
Select RegEx Flags
Toggle Global (`g`), Case-Insensitive (`i`), Multiline (`m`), DotAll (`s`), and Unicode (`u`) flags.
Input Test String
Paste sample text, log lines, or code to test pattern matches against.
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.
Related Utilities
Discover complementary online tools in the same workflow.
JSON Formatter & Validator
Format, beautify, minify, validate, and view JSON data online with instant syntax highlighting and error detection.
Base64 Encoder & Decoder
Encode text or binary data into Base64 format or decode Base64 back into raw string format.
CSV to JSON Converter
Easily convert CSV data to clean JSON format. Turn tabular spreadsheets into structured JSON.
YAML to JSON Converter
Convert YAML configuration files into structured JSON for APIs and modern web tooling.
JWT Parser & Token Debugger
Decode JWT tokens to view header, payload claims, and expiration status without sending secrets anywhere.
Hash Generator (SHA-256, SHA-512, MD5)
Generate cryptographically secure SHA-256, SHA-512, SHA-384, and SHA-1 hashes for any text.