Skip to main content
Best Web Developer logo
Language and currency EN £ GBP

Language

    Currency

    Prices on this site are shown in the currency you choose.

    Developer Tools

    Regex Tester

    Including the zero-length match trap that makes a pattern loop for ever.

    • Runs in your browser
    • Nothing uploaded

    The tool

    Enter a pattern, any flags, and the text to test it against. Matches appear as you type.

    Everything you enter stays on your own machine. Nothing is sent to us or to anyone else, which you can confirm in your browser network tab.

    What people use it for

    • Working out why a pattern matches one string and not another
    • Checking a validation rule before putting it in production
    • Extracting fields from a log line
    • Testing a redirect or rewrite pattern
    • Learning what a pattern somebody else wrote actually does

    About this tool

    JavaScript flavour

    This uses the browser own regular expression engine, so what you see is exactly what JavaScript will do. That matters because flavours differ: lookbehind, named groups and Unicode property escapes are supported in modern browsers but not everywhere, and PCRE, Python and Go each have their own quirks. A pattern proven here is proven for JavaScript, not universally.

    Flags

    The global flag is added automatically, because without it you only ever see the first match. Add i for case insensitivity, m to make ^ and $ match at line breaks, s to let the dot match newlines, and u for proper Unicode handling.

    The zero-length match trap

    A pattern that can match nothing, such as a*, will match an empty string at every position. With the global flag, a naive loop never advances and hangs the page. This tool nudges the index forward when that happens, which is the same guard your own code needs if it loops over matches manually.

    Reading the groups

    Every capturing group is listed under its match. A group that did not participate shows as no match rather than an empty string, which is a distinction that matters: an optional group that matched nothing and one that matched an empty string behave differently in most languages.

    Need this handled across a whole website? See our Backend Web Development and Custom Web Apps page.

    Questions

    Questions about this tool

    The things clients actually want to know — costs, timelines, ownership and what happens after launch.

    JavaScript, because it uses the browser own engine. Patterns may behave differently in PCRE, Python or Go.

    Without it you only ever see the first match, which is rarely what you want from a tester.

    A cap, so a pattern matching thousands of times cannot freeze the page.

    That the group did not participate in the match at all, which is different from matching an empty string.

    No. The matching happens in your browser.

    Free strategy session

    Let’s build something worth finding.

    Tell us where you want the business to be in twelve months. We will come back with a costed plan, a realistic timeline, and the numbers we expect to move — no obligation, no jargon.

    • 30-minute call, no pitch deck
    • Fixed-price proposal in 48 hours
    • You own everything we build

    Talk to a developer

    Not a sales team

    Response time
    Within 1 business hour
    Where we work
    UK, USA & the Gulf
    Contracts
    No lock-in, monthly rolling
    Working since
    2023
    infobestwebdeveloper.org

    Free strategy session

    Let’s build something worth finding.

    Tell us where you want the business to be in twelve months. We will come back with a costed plan, a realistic timeline, and the numbers we expect to move — no obligation, no jargon.

    • 30-minute call, no pitch deck
    • Fixed-price proposal in 48 hours
    • You own everything we build

    Talk to a developer

    Not a sales team

    Response time
    Within 1 business hour
    Where we work
    UK, USA & the Gulf
    Contracts
    No lock-in, monthly rolling
    Working since
    2023
    infobestwebdeveloper.org
    Free consultation

    show prices in SGD?

    Video