Skip to content

Choose your path

Built around the job you need to finish

Test one ECMAScript regular expression with exact flag semantics, bounded input, capture and replacement evidence, while refusing common catastrophic-backtracking shapes and disclosing that heuristic screening is not a sandbox.

JavaScript developer debugging extraction

Confirm first-versus-global behavior, indices, groups, Unicode and replacement semantics in the same engine family as production.

Enter pattern/test text, set exact flags, inspect matches and groups, toggle replacement and save the record.

Can reproduce the result without assuming PCRE, Python or Java compatibility.

Security reviewer assessing user-controlled patterns

Prevent a browser demo from being treated as a safe regex execution service.

Test known dangerous structures, confirm conservative refusal, document length/resource bounds, and require a terminable isolated production engine.

No untrusted pattern is approved solely because this page returned quickly.

Unicode and accessibility reviewer

Verify zero-length iteration across surrogate pairs and operate every flag/result control without visual-only meaning.

Test emoji with `gu`, read positions and warnings, copy evidence and use Project save.

Gets finite, correctly indexed results and named controls with no hidden safety claim.

Was this tool helpful?

Reference & details

How it works

Regular Expression Engine

Patterns are evaluated using JavaScript's RegExp engine (ECMAScript standard). Syntax follows JS conventions: \d for digits, \w for word characters, ^ and $ for anchors, and (?...) for groups and lookaheads.

Flags

The available flags are g (global), i (case-insensitive), m (multiline anchors), s (dotAll), and u (Unicode). With g off, matching and replacement stop after the first match; with g on, results are capped at 500.

Quantifiers and Greedy Matching

Quantifiers (*, +, ?, {n,m}) control how many times a preceding element repeats. By default they are greedy (match as much as possible). Append ? for lazy matching (match as little as possible).

Updated: July 2026

Example Scenarios

Use a bounded pattern to find email-like substrings for later application-level validation; a regex match does not prove deliverability, ownership, or standards compliance.

Pattern: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}

Highlights candidate substrings and records exact match indices

Use a capture group to pull ISO dates (YYYY-MM-DD) from server log lines.

Pattern: (\d{4}-\d{2}-\d{2})

Group 1 captures each date match

Test a pattern that accepts common US phone formats with optional country code and separators.

Pattern: ^(\+1[-.]?)?\(?\d{3}\)?[-.]?\d{3}[-.]?\d{4}$

Matches (555) 123-4567 and +1-555-123-4567

Common Mistakes to Avoid

Forgetting to escape special characters

Characters like . * + ? [ ] ( ) { } | \ ^ $ have special meaning. Use \ to match them literally. A dot (.) matches any character; \. matches a literal period.

Assuming regex works identically across languages

Python, Java, PCRE, and JavaScript differ on features like lookbehind support and word boundaries. Test with the engine your production code uses — this tool uses JavaScript RegExp.

FAQ

This page uses the current browser's JavaScript RegExp implementation and exposes g, i, m, s, and u. Do not assume compatibility with PCRE, Python, Java, .NET, RE2, or another runtime without testing there.

g finds all matches instead of just the first. i makes matching case-insensitive. m treats ^ and $ as line anchors in multiline text. Combine flags as needed for your use case.

Common issues: unescaped special characters, missing flags (e.g., i for case-insensitivity), greedy vs lazy quantifiers, or anchors (^ $) restricting where matches can start. Check the error message for syntax problems.

Parentheses ( ) create capture groups that extract matched substrings. Group 0 is the full match; groups 1, 2, etc. are nested captures. Use (?:...) for non-capturing groups when you don't need the extracted value.

Greedy quantifiers (*, +, {n,}) match as much text as possible. Lazy versions (*?, +?, {n,}?) match as little as possible. For example, on "<b>bold</b>", .* matches the entire string while .*? stops at the first closing tag.

About Regex Tester

Build and debug regular expressions without leaving your browser. Enter a pattern and test string to see all matches, capture groups, and match indices highlighted in real time — essential for validation, parsing, and search-and-replace tasks.