RegexForgeregex tester

RegexForge

Build a regex you actually understand.

Paste a pattern and a sample of text. RegexForge highlights every match, lists each capture group, explains the pattern token by token and hands you the same regex as JavaScript, Python, Go or Rust code. Everything runs in this browser tab — nothing is uploaded.

Presets

One click loads a pattern, its flags and a sample text.

Tester

Pattern and text never leave this tab.

Safe run: matching happens in a Web Worker and is cut off after 700 ms.

Flags change how the engine reads the pattern.
g global
Find every match, not just the first one.
i ignore case
Treat A and a as the same character.
m multiline
Make ^ and $ match at every line break.
s dotAll
Let . match line breaks too.
u unicode
Enable full Unicode mode, \p{…} and astral characters.
d indices
Record the start and end index of each group.
y sticky
Match only at the position given by lastIndex.

Matches

Index, length and every capture group.

—

Highlighted text

Match list

    No matches yet.

    Replace preview

    Uses $1, $2, $&, $ and $$ like JavaScript's String.replace.

    
        

    Type a replacement to preview the result here.

    Explainer

    Every token, in the order the engine reads it.

      Type a pattern to see it broken down token by token.

      Code export

      The same pattern, flags and replacement as runnable code.

        Generated from your current pattern, flags and replacement.

        Cheat sheet

        The twenty-one tokens that cover most real patterns.

        TokenWhat it meansExample
        .any single character except line breaksa.c → abc
        ^start of the string, or of a line with m^Hi
        $end of the string, or of a line with mend$
        *zero or more of the previous itemab*
        +one or more of the previous itemab+
        ?optional item, or lazy marker after a quantifiercolou?r
        {n,m}between n and m repetitions\d{2,4}
        [abc]one character from the set[aeiou]
        [^abc]one character outside the set[^0-9]
        \done digit\d{3}
        \wone word character\w+
        \sone whitespace character\s+
        \bword boundary\bcat\b
        (...)capturing group(\d{4})-(\d{2})
        (?:...)non-capturing group(?:ab)+
        (?<name>...)named capturing group(?<year>\d{4})
        (?=...)lookahead\d+(?= KRW)
        (?!...)negative lookahead\d+(?! KRW)
        (?<=...)lookbehind(?<=KRW )\d+
        a|beither alternativecat|dog
        \1backreference to group 1(\w)\1

        What it does

        A tester, a teacher and a code generator in one static page.

        Live matching

        Every match is highlighted as you type, with its index, its length and each capture group — numbered and named.

        Guard against runaway patterns

        Matching runs in a Web Worker with a 700 ms cut-off, and nested quantifiers are flagged before they freeze the tab.

        Token-by-token explainer

        Classes, quantifiers, anchors, groups, lookarounds, backreferences and flags are broken down into readable steps.

        Presets that actually run

        Email, URL, Korean mobile, ISO date, IPv4, UUID and a Hangul + Latin filter, each with sample text.

        Code in four languages

        Export to JavaScript, Python, Go and Rust, with a note wherever an engine lacks a feature your pattern uses.

        Private by design

        No upload, no account, no analytics. Pattern, text and replacement stay in the browser and can be wiped in one click.

        How to use it

        Three steps from a vague idea to a pattern you trust.

        1. 1

          Describe the text

          Type a pattern, or pick a preset and edit it. Paste a sample that includes both matches and near-misses.

        2. 2

          Watch the matches

          Turn flags on and off and see where the pattern succeeds, where it stops and which groups captured what.

        3. 3

          Read, then export

          Check the explainer when a match surprises you, then copy the snippet for the language you are writing.

        Questions

        The things people ask before pasting a real pattern.

        Is my test text sent anywhere?

        No. Matching, highlighting, explaining and code generation all run as JavaScript in this tab. The only external file on the page is the ad loader; the tester itself makes no network requests.

        Which regex flavour is used?

        The browser's own JavaScript RegExp engine, so what you see here is what your JavaScript will do. Flags g, i, m, s, u, d and y are supported.

        Why did my pattern stop with a timeout?

        Some patterns backtrack exponentially on text that almost matches. RegexForge runs the match in a Web Worker and stops it after 700 ms, so the page stays responsive. Simplify nested quantifiers such as (a+)+ or (.*)* to fix the pattern itself.

        Why do Go and Rust show a warning?

        Go's RE2 engine and Rust's regex crate are linear-time engines: they do not support lookarounds or backreferences. The exported snippet says so instead of failing silently. Python and JavaScript support them.

        Does it remember what I typed?

        Only in this browser's localStorage: the theme and your last pattern, flags, text and replacement. Nothing is transmitted, and the Clear saved settings button removes it.

        Is it free?

        Yes. Ads keep the site running; the tool has no paid tier and no account.

        Privacy

        Nothing you type leaves the page

        Patterns, sample text and replacements are processed in memory in this tab. The only stored data is your theme and last inputs, kept in localStorage on your own device.

        Read the privacy policy →