Send feedback

Coming from the page: Regex Tester

One moment…

JavaScript flavourReady-made patternsNever hangs the page

Regex Tester

Type an expression and some text, and see the matches and groups instantly.

//gu
Highlighted matches

    The expression and text are tested inside your browser by its own JavaScript engine; nothing is sent anywhere.

    How to use it

    1

    Type the expression

    Without the slashes; pick flags below it, or start from a ready-made pattern.

    2

    Paste text

    Matches are highlighted at once, with a list of every match, its groups and positions.

    3

    Replace

    Tick Replace and write the new text with $1, $<name> or $& for the whole match.

    Symbols you’ll use a lot

    SymbolMeaning
    \dDigit 0-9
    \wLetter, digit or _ (ASCII only)
    \p{L}Any letter in any script (with u)
    \sSpace, tab or newline
    ^ $Start and end (of each line with m)
    (?<name>…)Named group
    a{2,5}2 to 5 times

    Good to know

    \w is ASCII only. In JavaScript \w doesn’t match é or Arabic. Use \p{L} with the u flag for letters in any language.

    Safe from hangs. Patterns like (a+)+$ can take years on some inputs (catastrophic backtracking). We run the expression in a separate thread and stop it after 2 seconds.

    JavaScript flavour. Results match browsers and Node.js. Python, PHP and others agree on the basics but differ in details.

    FAQ

    What is a regex?

    A regular expression describes a text pattern, like “05 then 8 digits” for a mobile number, to search for it, validate it or replace it. Nearly every programming language supports them.

    How do I match non-English words?

    Use \p{L}+ (any letter) or \p{Script=Arabic}+ with the u flag.

    What’s the difference between the u and v flags?

    u enables full Unicode and \p{…}; v is newer and adds set operations like [\p{L}--[a-z]]. They can’t be combined.

    Is my text sent anywhere?

    No. Testing happens in your browser.