LiveDedicated Web Worker

Regex Tester & Debugger

Test JavaScript regular expressions with match highlighting, flags, offsets, and capture groups.

Debug JavaScript regular expressions against sample text with match offsets, numbered and named capture groups, safe DOM highlighting, and a dedicated worker timeout for runaway backtracking.

Workbench

Use Regex Tester & Debugger

Ctrl/⌘ + Enter to test
g
Flags
Examples:
Test Corpus

Test String

Paste sample text to match against
Visual Output

Match Highlight Canvas

0 matches found
Matches will be highlighted here in real time...
Ready. Modify pattern or test text to evaluate with isolated Web Worker.
Matches
0
Captures
0
Execution
0ms
Engine
Web Worker (200ms limit)
Diagnostics

Capture Group & Offset Breakdown

Detailed offset boundaries and group extractions
Regular Expression Matches and Capture Groups
#RangeFull MatchCapture Groups
No matches yet. Enter a valid pattern and test text.
What it does

Built for the task, not the page view

  • JavaScript flags g, i, m, s, u, and y
  • Numbered and named capture groups with match offsets
  • Dedicated Web Worker execution with a 200ms responsiveness timeout
  • Zero-length match safeguards and a 5,000-match cap
  • Email-like, IPv4 extraction, and ISO date extraction examples
Inputs & outputs
Accepts
JavaScript Regex PatternTest Text
Produces
Match HighlightsCapture Group TableMatches JSON
Reference

Use it correctly

JavaScript vs. PCRE regex semantics

This tool evaluates regular expressions using your browser’s native ECMAScript RegExp engine (ECMA-262). JavaScript regex does not support PCRE-specific features like atomic grouping (?>...), recursive patterns (?R), branch reset groups (?|...), or POSIX character classes like [:digit:]. Always verify against JavaScript syntax if deploying to Node.js or browser environments.

Catastrophic backtracking (ReDoS) protection

Nested quantifiers like (a+)+ or ambiguous alternations can trigger exponential backtracking when evaluating non-matching input. To protect your browser tab from freezing, this tool runs evaluation in a dedicated Web Worker with a strict 200ms timeout. Terminating the worker preserves UI responsiveness, but does not make a dangerous regex safe for server-side use.

Named capture groups & match offsets

Modern JavaScript supports named capture groups using (?<name>expression). When matched, these groups appear under match.groups in JavaScript code. This tester displays start and end character offsets, numbered group indices, and named group labels for every match.

Lookahead & lookbehind compatibility

Lookahead assertions (?=...) and (?!...) are supported across all modern browsers. Lookbehind assertions (?<=...) and (?<!...) were introduced in ES2018; modern Chromium, Firefox, and Safari 16.4+ support them, but older WebKit/iOS versions may throw syntax errors.

In-browser privacy & analytics isolation

All regular expression compilation and matching execute inside a dedicated Web Worker in your local browser tab. Neither your regex pattern nor your test corpus is sent to an EveryTools transformation API or analytics service. Analytics record only fixed UI event identifiers, never user-entered text.

Cheatsheet

Common Pattern Starters & Practical Snippets

These starter patterns demonstrate real-world JavaScript regular expression idioms.Notice: These snippets are practical extraction and matching examples, not rigorous RFC or calendar validators.

Email-like matching (example)

Extracts user and domain parts using named capture groups. Practical for sanity-checking form inputs.

(?<user>[a-zA-Z0-9._%+-]+)@(?<domain>[a-zA-Z0-9.-]+\.[a-zA-Z]{2,})
Not an RFC 5322 validator (which permits quoted strings, comments, and IP literals).

IPv4 address extraction (example)

Captures four dot-separated numeric octets using word boundaries.

\b(?<octet1>\d{1,3})\.(?<octet2>\d{1,3})\.(?<octet3>\d{1,3})\.(?<octet4>\d{1,3})\b
Matches numbers up to 999. Validating 0–255 ranges requires numerical parsing or complex range alternation.

ISO 8601 date & timestamp (example)

Extracts YYYY-MM-DD dates with optional time and UTC/offset indicators.

(?<year>\d{4})-(?<month>0[1-9]|1[0-2])-(?<day>0[1-9]|[12]\d|3[01])(?:T(?<time>(?<hours>[01]\d|2[0-3]):(?<minutes>[0-5]\d):(?<seconds>[0-5]\d)(?:\.\d+)?)(?<timezone>Z|[+-][01]\d:?[0-5]\d)?)?
Does not validate leap years or days per month (e.g. February 30th). Use Date.parse() for calendar checks.
Safety & Performance

Catastrophic Backtracking & ReDoS Prevention

Regular Expression Denial of Service (ReDoS) occurs when a regular expression engine enters exponential backtracking. When a pattern contains nested quantifiers or overlapping alternations (such as (a+)+$ or (a|a)+$), testing against an almost-matching string like "aaaaaaaaaaaaaaaaaaaa!" requires the backtracking engine to test millions of permutations before failing.

Why Web Worker isolation matters

In standard web applications, running regular expressions on the main UI thread blocks the JavaScript event loop. An exponential backtracking expression freezes the entire browser tab, preventing user clicks, scrolling, and page responsiveness. EveryTools runs all arbitrary regex evaluation inside a dedicated background Web Worker.

The 200ms timeout safeguard

When a regex evaluation starts, the client sets an unyielding 200ms timer. If the Web Worker does not produce a completed match result within 200 milliseconds, the main thread terminates the worker immediately viaworker.terminate() and alerts the user.

Important security distinction:Worker termination protects your local browser tab’s responsiveness by cutting off runaway execution. It does not claim that a pattern is safe for backend use. If you deploy a regex that triggers a timeout here to an unconstrained Node.js server or Python backend, it may cause high CPU utilization and denial of service.
Specification

JavaScript ECMAScript RegExp Engine Reference

This debugger complies strictly with standard ECMAScript (ECMA-262) RegExp specifications.

Supported JavaScript RegExp Flags
FlagNameECMAScript Semantics
gGlobalFinds all matches across the entire text rather than stopping after the first match.
iIgnore CaseEnables case-insensitive character matching for ASCII and Unicode ranges.
mMultilineChanges ^ and $ to match the start and end of each line, not just the entire string.
sDotAllAllows the dot (.) metacharacter to match newline characters (\n, \r).
uUnicodeEnables full Unicode code point handling and enables \p{...} property escapes.
yStickyMatches only from the index indicated by the lastIndex property in the target text.

Metacharacter Cheat Sheet

Common Metacharacters in JavaScript
TokenMeaningExample
^ / $Beginning / end of string (or line with m flag)^Every
\b / \BWord boundary / non-word boundary\btool\b
\d / \DDigit [0-9] / non-digit\d{3}
\w / \WWord character [a-zA-Z0-9_] / non-word character\w+
\s / \SWhitespace / non-whitespace\s*=\s*
(?<name>...)Named capture group (accessible via match.groups.name)(?<id>\d+)
(?:...)Non-capturing group (groups tokens without capturing in match array)(?:https?|ftp)
(?=...) / (?!...)Positive / negative lookahead assertion\d+(?=px)
(?<=...) / (?<!...)Positive / negative lookbehind assertion (ES2018+)(?<=\$)\d+
Q&A

Frequently Asked Questions

What are the differences between JavaScript and PCRE regex?

Perl Compatible Regular Expressions (PCRE) is widely used in PHP, Apache, and C tools, offering features absent in ECMAScript: atomic groups ((?>...)), possessive quantifiers (*+, ++), recursive expressions ((?R)), subroutine calls, and branch reset groups ((?|...)). JavaScript RegExp engines run native ECMAScript semantics. Do not use PCRE-specific syntax in JavaScript code.

How do named capture groups work in modern JavaScript?

Introduced in ES2018, named capture groups use the syntax (?<groupName>subpattern). When an expression matches, the results object includes a groups dictionary mapping group names to their matched strings. This tester extracts both numbered indices ($1, $2) and named keys along with start and end character offsets.

How does this tester prevent browser tab freezing?

By delegating evaluation to a dedicated Web Worker off the main rendering thread, the browser UI remains completely responsive. A hard 200ms timeout cancels any run that takes too long. If an expression backtracks indefinitely, the background worker is immediately killed with worker.terminate() and a ReDoS diagnostic warning is displayed.

Does EveryTools store or inspect my regular expressions or sample data?

No. All regex evaluation and test string processing happen exclusively inside your browser's Web Worker. No regex patterns, test strings, or matched results are transmitted to any server. Our analytics system records only fixed interaction events (such as viewing the page or clicking "Test"), with zero payload content.