Skip to main content
ZEKILO Dev

Regex Tester

Type a pattern and see each match, its groups, and its position in your text right away.

Stays in your browserECMAScriptAs of 2026.10.03

Flags

Test text

Press Esc, then Tab to leave the editor.

Matches in the text

The result appears here

How to use Regex Tester

  1. 1Type a pattern into Regular expression without the surrounding slashes, or press Sample.
  2. 2Paste the text to search into Test text and tick the flags you need. Matches are highlighted as you type.
  3. 3Set Mode to Replace or Split to preview the result, then press Copy or Download.

Regex Tester options

Flags
g finds every match (on by default). i ignores case. m lets ^ and $ match at each line. s lets the dot match line breaks. u turns on Unicode mode. y matches only at the current position. d adds the start and end of each group. v (Unicode sets) appears only in browsers that support it and cannot be combined with u.
Mode
Find lists the matches. Replace previews the text after replacement, and the replacement can use $1, $<name>, and $&. Split cuts the text at every match, like String.prototype.split.
Time limit
A pattern runs for at most 1 second. If it needs longer, it is stopped and a message is shown. This limit cannot be changed.

Syntax: JavaScript, not PCRE

This tool uses JavaScript (ECMAScript) syntax. See the table below for differences from PCRE, Python, and Java.

The pattern is run by the regular expression engine built into your browser, as defined in the ECMAScript specification. What you see here is what RegExp returns in your own JavaScript code in the same browser.

Feature JavaScript PCRE (PHP) Python re Java
Named group (?<name>…) (?<name>…) or (?P<name>…) (?P<name>…) (?<name>…)
Back-reference by name \k<name> \k<name> or (?P=name) (?P=name) \k<name>
Group in the replacement $1, $<name> $1 or \1 \1, \g<name> $1, ${name}
Inline flag (?i) Not supported. Use the flags instead Supported Supported at the start Supported
Atomic group (?>…), a++ Not supported Supported Supported from 3.11 Supported
Lookbehind (?<=…) Any length Bounded length Fixed length Bounded length
\A, \Z anchors Not supported. Use ^ and $ Supported Supported Supported
Recursion (?R) Not supported Supported Not supported Not supported
Free-spacing mode with comments Not supported x flag re.VERBOSE Pattern.COMMENTS
\d ASCII digits only ASCII by default Any Unicode digit ASCII by default

Why there is a time limit

Most JavaScript engines match by backtracking. A pattern with a quantifier inside another quantifier, such as (a+)+$, can take time that doubles with each extra character when the text almost matches. Thirty letters are enough to keep an engine busy for seconds. This tool runs every pattern in a separate background thread, stops it after 1 second, and starts a fresh one for your next input, so typing never freezes.

Regex Tester examples

  • Find phone numbers (flag g)

    Line 1 is the pattern and line 2 is the test text. Two matches: index 5 with groups 010, 1234, 5678, and index 33.

    Input

    (\d{3})-(\d{4})-(\d{4})
    연락처: 010-1234-5678, 02-123-4567, 010-9876-5432

    Output

    010-1234-5678
    010-9876-5432
  • Replace with group references

    Mode: Replace. Line 2 is the replacement. $1 and $3 are the first and third groups.

    Input

    (\d{3})-(\d{4})-(\d{4})
    $1-****-$3
    연락처: 010-1234-5678, 02-123-4567, 010-9876-5432

    Output

    연락처: 010-****-5678, 02-123-4567, 010-****-5432
  • Named groups

    Input

    (?<year>\d{4})-(?<m>\d{2})
    2026-10

    Output

    year: 2026
    m: 10
  • A pattern that backtracks without end

    The run is stopped after 1 second and the page keeps working.

    Input

    (a+)+$
    aaaaaaaaaaaaaaaaaaaaaaaaaaaaaab

    Output

    The pattern takes too long
  • Unclosed group

    Input

    (

    Output

    Invalid regular expression

Examples use the reference cases this tool is tested against.

Regex Tester: frequently asked questions

Is my input sent to a server?

No. Your input and the result are processed only in this browser and are not stored. Reloading the page clears them.

Why does a pattern from PHP, Python, or Java fail here?

Regex syntax differs between languages. Inline flags such as (?i), atomic groups, possessive quantifiers, and anchors like \A are not part of JavaScript. The table on this page shows what to write instead.

What does “The pattern takes too long” mean?

The pattern ran for more than 1 second. Nested quantifiers such as (a+)+ can make the engine try an enormous number of paths, which is called catastrophic backtracking. The run is stopped so the page stays responsive. Remove the nesting, for example a+$ instead of (a+)+$.

How are index, line, and column counted?

Index is the JavaScript string index in UTF-16 code units, the same value as match.index. Line and column start at 1, and the column counts characters (code points), so an emoji is one column.

How much text and how many matches can it handle?

The test text can be up to 5 MB. Up to 1 MB is processed as you type, and above that you press Run. The first 10,000 matches are highlighted and listed, and the total count is always shown.

How it works · Standards

  • Processed in: this browser (your device). Nothing is sent or stored.
  • Standards: ECMAScript
  • Engine: The browser's built-in RegExp engine (ECMAScript) (part of the browser)
  • Each browser has its own engine, so newer syntax such as the v flag may not work everywhere. Unsupported syntax is reported as an invalid regular expression.
  • Safari's engine gives up on runaway backtracking by itself and reports no match, so on a fast device a pattern like (a+)+$ may show No match instead of the time limit message.
  • An empty match, for example from a*, is drawn as a thin bar in the highlighted text.
  • Only the mode and flags are remembered. The pattern, the test text, and the replacement are never stored.
  • As of 2026.10.03
  • Changelog: 2026.10.03 First release
Open-source licenses →
Something wrong with the result? Report an issue(Your input is not attached)