A LITTLE PATTERN. A LOT OF CLARITY.

Find the pattern.
Refine the result.

Test a regular expression, explore every match and preview a careful text replacement. All in your browser, with the details that matter.

JAVASCRIPT REGEXCAPTURE GROUPSLOCAL PROCESSING
REGEX TESTER & TEXT REPLACER

Make your text work.

Browser support is checked on each run.

g all matches · i ignore case · m multiline · s dot-all · u Unicode · v Unicode sets · d capture indices · y sticky

Paste text or open one UTF-8 file

Use Preview replacement to see changes. Without g, only the first match is replaced.

$$ dollar · $& match · $1 group · $<name> named group

256 KiB input · 4 KiB pattern · 5,000 matches · 1.5-second execution limit

Ready when you are. Paste text or try a sample.

Every match, in context.

Highlights, positions, captures and complete exports will appear here.

Your text stays in this browser. No upload, account or saved input history.
01 / TEST

Start with a real sample.

Set your pattern and flags. Use g for every match, and u for Unicode-aware matching.

02 / UNDERSTAND

Look inside each match.

Check exact positions, numbered captures and named groups. Add d to inspect capture ranges.

03 / REFINE

Review before replacing.

Choose template or literal replacement. Copy or download the complete result after reviewing the preview.

Know your pattern.

Which regex engine does this tool use?

Your browser’s native JavaScript (ECMAScript) RegExp engine. Enter the pattern without surrounding slash delimiters and enter flags separately. It is not PCRE, Python, Java or .NET regex. Support for newer flags and syntax depends on your browser; unsupported patterns are reported. Add g to find or replace all nonoverlapping matches. Without g, only the first match is used. Sticky y requires a match at the current offset, initially zero.

Which flags and pattern features can I use?

Use g for all matches, i for case-insensitive matching, m for multiline anchors, s for dot-all, u for Unicode-aware matching, v for Unicode sets, d for capture indices and y for sticky matching. Flags must be unique; u and v cannot be combined. Native lookarounds, backreferences, named captures and Unicode properties work when supported by your browser. The sample patterns illustrate formatting and extraction; they are not complete email, date or other semantic validators.

How do replacement templates work?

Template mode follows JavaScript replacement syntax: $$ inserts a dollar sign, $& the match, $1 through $99 available numbered captures, $<name> a named capture, $` the input before the match and $' the input after it. Unmatched captures become empty strings. Literal mode inserts the replacement exactly, including dollar signs. Review the complete output before using it; replacements are text only and never executable functions.

What do the positions and zero-length markers mean?

Offsets start at zero and count UTF-16 code units, with an exclusive end. Lines and columns start at one; columns also count UTF-16 code units. CRLF counts as one line break, as do CR, LF and Unicode line separators. Emoji can span two code units. A vertical marker shows a zero-length match. Global zero-length matching advances safely and uses whole code points with u or v. Matching a partial surrogate is reported exactly in JSON, but highlighting is disabled and replacements that would export invalid Unicode are rejected.

What limits protect the browser?

Use up to 256 KiB of UTF-8 input, a 4096-byte pattern and a 32 KiB replacement. A run can return at most 5000 matches and 20000 capture fields. Match details and replacement output are each limited to 2 MiB, and the JSON report to 4 MiB. Patterns execute in a separate Web Worker with a 1.5-second execution deadline after startup and a 5-second startup deadline. A slow or oversized run returns no partial result. You can cancel and try a simpler pattern. Performance varies by device.

Are previews and downloads the same size?

The match list shows 50 matches per page. Values initially show up to 160 Unicode code points; enable full values to see more. Highlighting covers at most 200 matches within the first 20000 code points. Replacement preview also shows up to 20000 code points. Copy and downloads contain the complete successful result. Matches-only JSON exports preserve every matched string, including empty matches and embedded line breaks. The JSON report includes original input, flags, matches, captures and replacement output, when requested.

Which files and line endings are supported?

Open one UTF-8 plain-text file. Invalid UTF-8 is rejected. An imported BOM and original line endings are retained until you edit the text. Textarea display and editing can normalize line endings, so use the downloads for byte-faithful line-ending review. Binary files such as PDF, DOCX and XLSX are not parsed. Files are limited by actual bytes, not only the file’s declared size.

Is my text uploaded or saved?

Pattern matching and replacement happen locally in a browser worker. The tool does not upload input, run replacement code, fetch user-provided URLs or save input history. Clear removes temporary results and download links. Normal site analytics and feedback services may still load. JSON and text reports include your input, so check their contents before sharing them.