Developer tools

Regex tester

Test JavaScript regular expressions locally. Highlight matches, inspect named capture groups and preview replacements with cancellable processing.

JavaScript syntax, without enclosing /slashes/. An empty pattern matches empty positions.

Matching options

Up to 256 KiB. Runs locally when you press Test pattern.

Source: editor text.

Import or drop a text file

Replaces test text with Undo available. UTF-8 BOM and original line endings are retained until you edit the text.

Paste a pattern and text, or try the date example.

Find text, inspect captures, then replace

Enter the pattern directly, without slash delimiters or JavaScript string quoting. For example, \d+ finds a run of digits. Enable g to find all matches; turn it off to inspect just the first. Matching is manual so typing does not launch a costly search. Changed inputs remove stale results.

The date example extracts year, month and day from 2026-10-12 and changes it to 12/10/2026 using named captures. It recognizes the shape of a date, not whether the date exists on a calendar. Input and matches are displayed as text, never HTML.

Which regular expression engine is used?

This tester uses your browser’s JavaScript RegExp engine. It is not PCRE, Python or .NET; syntax and supported features can differ. u and v are mutually exclusive Unicode modes. m changes ^ and $ to line anchors; s lets dot match newlines. y starts at position 0 and requires consecutive matches when combined with g. d adds capture offsets without changing what matches.

Zero-width matches appear as a labelled ∅ marker. Global searches advance after an empty match, using a Unicode code point in u or v mode. Ordinary positions still count UTF-16 code units, so an emoji can occupy two positions. Capture groups inside lookarounds may refer to text outside the full match.

Replacement syntax and limits

Replacement supports JavaScript string substitution tokens, including $$, $&, $1–$99, $<name>, $` (text before the match) and $' (text after it). Unmatched captures contribute empty text. Literal mode uses the replacement exactly as entered; no JavaScript replacement function is executed. If replacement splits a Unicode character into unpaired UTF-16 surrogates, copy and UTF-8 text download are disabled; the JSON report retains the exact escaped code units. Unicode u or v mode often avoids splitting characters.

Patterns are limited to 8 KiB, source text to 256 KiB and replacement templates to 16 KiB. The worker is terminated after five seconds and can be cancelled sooner. Up to 1,000 matches and 100 capture groups per match are retained, with 4 MiB limits on match details and replacement output. A match limit prevents a partial replacement. Smaller inputs and simpler patterns help with expensive backtracking.

Highlighted and replacement previews stop at 32,768 characters. Copy and Download include the complete replacement; match pagination exposes all retained matches. Files remain local. Imported byte-order marks and CRLF line endings are retained until editing; typing uses the textarea’s normalized line endings. Example, Clear, import and large paste offer one Undo that restores the previous test text, pattern, flags, replacement settings and filename; editing test text ends that history. Nothing is saved automatically.

References: JavaScript RegExp matching and ECMAScript replacement semantics.