Regex Tester
Test JavaScript regular expressions, inspect captures and preview replacements locally in a bounded worker.
JavaScript RegExp · flags are checked against your browser at execution. Use g for all matches; indices are zero-based UTF-16 offsets.
TEST TEXT
Enter a pattern and text, then test explicitly. An empty pattern matches empty positions.
Enable JavaScript to test locally. No server submission is available.
JavaScript RegExp, locally.
Enter the pattern without slash delimiters, choose flags, add test text and select Test Regex. Use g to collect successive matches. Without g, only the first match is returned; y starts at index zero and requires consecutive matches when combined with g.
Captures without guesswork.
Inspect each match, numbered captures and named groups. The d flag includes capture indices when supported. All positions count UTF-16 units, just like JavaScript. Empty matches advance safely, by a full code point in u or v mode.
Temporary by design.
Patterns, text and replacements stay in browser memory. Nothing is sent, logged or stored. Editing cancels active work and clears stale results; Reset and navigation discard the workspace.
Test deliberately.
Can a slow regex freeze the page?
Execution uses a dedicated worker. The page terminates it after a 250 ms deadline following readiness; startup has a separate 5 second limit. Cancel stops it immediately. There is no main-thread fallback or automatic retry. A timeout does not establish whether the pattern would eventually match.
Which flags are supported?
The worker checks d, g, i, m, s, u, v and y against your browser. Unknown, repeated or unavailable flags reject. u and v are mutually exclusive. PCRE, Python and other engines are not emulated.
How does replacement work?
Replacement is a string with native JavaScript dollar-token semantics, not executable code. Enable Preview replacement before testing. A complete result is produced only when at most 100 matches occur and the conservative output budget fits 256 Ki UTF-16 units. Copy and download use the full result.
What are the size and display limits?
Pattern and replacement are each limited to 1 KiB UTF-8; test text to 64 KiB. Results stop after the first 100 matches, with at most 64 captures. Each capture preview is at most 512 characters, with 64 Ki total capture text. Highlighting shows the first 8,192 UTF-16 units. Truncation is labeled and never changes match positions.
Are examples suitable for production validation?
Examples teach extraction and flags. In particular, the email-like example is not a universal email validator. Use requirements and tests appropriate to your own data.