XTools Logo
XTools
Blog
/
JSON Formatter & YAMLXML FormatterCode Formatter & MinifierJSON to TypeScriptMarkdown ⇄ HTMLMermaid Diagram EditorRegex TesterJWT DecoderUUID GeneratorEncode & DecodeCron Expression BuildercURL Command BuilderMeta Tag GeneratorPX to REM & Line HeightCSS GeneratorChmod Calculator

© 2026 XTools. All rights reserved.

Privacy PolicyContact Us

    Regex Tester

    Test regular expressions with live match highlighting, groups, and replace
    • Files never leave your device
    • Runs in your browser
    • Free, no sign-up, no watermark
    /
    (?<year>\d{4})-(?<month>\d{2})-(?<day>\d{2})
    /g
    Release log 2024-03-15 v1.4.0 shipped to production 2024-11-02 v1.5.0-beta.2 opened for testing 2025-01-20 v2.0.0 released, contact releases@example.com Not dates: 2025-1-20, 20240315, 24-01-01​
    Matches will be listed here.

    Options

    Common patterns

    Click to load. Your test text is kept unless it is empty or still a sample.

    Related tools

    • JSON Formatter & YAML
    • XML Formatter
    • Code Formatter & Minifier
    • JSON to TypeScript
    • Markdown ⇄ HTML
    • Mermaid Diagram Editor
    • JWT Decoder
    • UUID Generator
    • Encode & Decode
    • Cron Expression Builder
    • cURL Command Builder
    • Meta Tag Generator
    • PX to REM & Line Height
    • CSS Generator
    • Chmod Calculator

    How to use Regex Tester

    Test JavaScript regular expressions against your text with live highlighting, capture groups, and a replace preview. Each pattern is explained token by token, and the tool generates ready-to-run JavaScript. Matching runs in a background worker, so a runaway pattern stops instead of freezing the page.

    1. 1

      Type a pattern in Regular expression, or pick one from Common patterns. Pasting /pattern/flags fills in the flags too.

    2. 2

      Toggle the flags you need, such as g, i, m, or s.

    3. 3

      Paste your text into Test string. Matches are highlighted; hover one to see its groups.

    4. 4

      Use the Matches, Explanation, and Code tabs, or turn on Replace to preview the result of string.replace().

    Frequently asked questions

    Which regex flavor does it use?

    JavaScript, the engine built into your browser. Flags g, i, m, s, u, y, d, and v are supported. Syntax specific to PCRE, Python, or Java may behave differently.

    Why does it only find one match?

    Without the g flag, JavaScript stops at the first match. Turn on g (global) to find them all.

    What does "Stopped after 1.5 s" mean?

    The pattern took too long on this text, usually from catastrophic backtracking with nested quantifiers like (a+)+. Make the inner parts more specific or anchor the pattern.

    How do I use named groups in the replacement?

    Write $<name> for a named group, $1 for a numbered one, and $& for the whole match. The buttons under Replace with insert these tokens.

    Is my test text stored or uploaded?

    Your text is never uploaded. The pattern, flags, and replacement are remembered in this browser; the test string is not.