Regular expression tester

Test a JavaScript regular expression against sample text in your browser: live match highlighting, capture groups, flags and a replacement preview.

Last updated

Flags


    

    Notes

    • This uses the JavaScript engine in your browser, so the syntax is exactly what new RegExp(pattern, flags) accepts. Other languages differ in details (lookbehind support, \d and Unicode digits, named-group syntax).
    • Matching runs on your machine. A pattern with nested quantifiers such as (a+)+$ against a long non-matching string can take exponential time; if the page stops responding, close the tab.
    • Without the g flag only the first match is reported, which is also how String.prototype.match behaves.

    Learn the syntax in Regular expressions, the useful 20%.