Regular expression test

Check JavaScript regular expression matching, capture groups, and substitution. Stop for slow patterns and process input in the browser.

Regular expression test input

/ input without separator · g: find all · i: ignore case

Substitute·Flag help

m: start and end of line; s: point including line break (.), u: Unicode; y: only consecutive positions. Executed using JavaScript regular expression.

$&: All matches, $1: First group, $<name>: Name group, $$: Dollar symbol. Leaving a placeholder empty removes the match part.

Input is not saved or sent. Sharing includes only a summary.

Result

Results appear here after execution.

Share result

Share the tool link and result text together. No URL is included in the result. Check the below content and then share it.

Usage examples and processing criteria

Pattern (?<name>[han-ihk]+), when entering the flag g and the text “Seoul 12, Busan 34”, it matches Seoul (0–2) and Busan (7–9) twice. Using the placeholder [$<name>] results in “[Seoul] 12, [Busan] 34”. The position starts at 0 in UTF-16 index, and the end position is excluded.

Frequently Asked Questions

Is the regular expression for other languages the same?

Uses the JavaScript regular expression engine of the current browser. Syntax and results may differ from Python or PCRE. Remove separators and enter g·i·m·s·u·y flags.

How are infinite executions or very large results handled?

Execution is performed in a separate Worker. It stops after 750ms after preparation. Limits: 200,000 characters, 2,000 patterns, 1,000 collections, 1,000,000 combined matching strings. When limited, it shows as partial; substitution is stopped. Can be canceled during processing.

How does empty matching and substitution groups appear?

Empty matching is marked with ∅ in the preview and moves to the next UTF-16 position. With the u flag, supplementary characters are not split into two. Non-participating groups are null. $&, $1, $<name>, $$ supports front/back context substitution, and the result is up to 1,000,000 characters.

Calculation criteria and reference materials

Verification of calculation criteria: · Calculation·verification principles · Report errors