Skip to content

Regex Tester FREE

Test regular expressions live in your browser. See highlighted matches, capture groups, named groups and a token-by-token explanation of the pattern.

Free to use No registration Privacy-first
01Input

Test a regular expression

Enter the pattern without the surrounding slashes, paste the text to test, then choose the flags. Matching happens in your browser as you type.

Engine JavaScript / ECMAScript Runs in your browser: nothing is uploaded

Do not type the surrounding slashes. A forward slash inside the pattern needs no escaping here.

As a literal

Your text is used exactly as entered. Nothing is trimmed, because leading and trailing whitespace can change what a pattern matches.

Flags

u and v are two different Unicode modes and cannot be combined: choosing one clears the other.

02Explanation

Pattern explanation

The pattern is read token by token in your browser. A construct this reader does not model is shown as it is written, rather than described incorrectly.

Enter a pattern above to see the breakdown.

03Result

Matches

Enter a pattern to see live matches

Matches, positions, capture groups and a breakdown of the pattern appear here as soon as you start typing. You can also load one of the common patterns below.

Match details and captured groups

Positions are JavaScript string indices, counted in UTF-16 code units. Characters outside the Basic Multilingual Plane, such as many emoji, count as two.

    This pattern found nothing in the current test string. That is a result, not an error: the pattern itself is valid.

    04Library

    Common patterns

    Practical starting points, each with a sample text. They are not complete validators: real email, URL, phone and date rules depend on the system you are building, so treat these as a first draft and adjust them.

    Text

    Development

    Poland

    05Reference

    About regular expressions in JavaScript

    01

    What a regular expression is

    A regular expression is a pattern that describes a set of strings. Instead of searching for one fixed word you describe its shape - four digits, then a hyphen, then two digits - and the engine finds every piece of text with that shape. Regular expressions are built into almost every editor, language and command-line tool.

    02

    How to use this tester

    Type a pattern without the surrounding slashes, switch on the flags you need, and paste the text you want to test. Matching runs on every edit, so the highlighted preview, the match list and the breakdown update as you type. Nothing is submitted and nothing is saved.

    03

    JavaScript and ECMAScript flavour

    Matching uses the regular expression engine built into your browser, which implements the ECMAScript specification. Other flavours are genuinely different languages: PCRE, PHP, Python, Java and .NET each add or drop syntax, so a pattern that works here may need changes elsewhere. This tool only reports what ECMAScript does.

    04

    Capture groups and named groups

    Parentheses capture the part of the match they surround, numbered from left to right. Naming them, as in (?<year>...), makes the same capture readable in code. An optional group that did not take part in the match is reported as not matched, which is a different thing from a group that matched an empty string.

    05

    Why matching runs in a worker

    Some patterns are pathological: (a+)+$ against a long run of a characters makes the engine try an astronomical number of paths. Matching therefore runs in a background thread with a time limit. If a run exceeds it, the thread is stopped and the tester says so - the pattern is expensive, not invalid - and the next pattern runs normally.

    06

    Privacy

    The pattern, the flags, the test string, the matches and the captured groups stay in this browser tab. They are not sent to POLPROG, not sent to analytics or error reporting, not written into the address bar, and not stored between visits. Closing the page is all it takes to remove them.

    Scope and limits

    What this tester covers

    In-browser ECMAScript matching, with the limits stated

    The tester runs your pattern against your text with the browser's own ECMAScript engine and reports what it returns: matches, positions, capture groups and named groups. It does not check other regex flavours, does not measure performance, and caps the test string at 200,000 characters and the detailed match list at the first 100 matches so a large result stays readable. The total number of matches is still reported in full.

    Help

    FAQ

    Does POLPROG see my regular expression or my test text?

    No. Everything runs in your browser: the pattern, the flags, the test string, the matches and the captured groups stay in the page. This tool has no API call, writes nothing to storage, and sends none of it to analytics or error reporting.

    Which regular expression flavour does this tester use?

    The ECMAScript engine built into your browser, the same one that runs JavaScript regular expressions. PCRE, PHP, Python, Java and .NET are different flavours with different syntax and different behaviour, so a pattern verified here is verified for JavaScript only.

    What happens with a pattern that never finishes?

    Matching runs in a background thread with a time limit of about one second. A pattern such as (a+)+$ on a long input can take effectively unlimited time; when the limit passes the thread is stopped and the tester reports that execution was stopped. The pattern is expensive, not invalid, and the next pattern you type runs normally.

    Why does a group show “not matched” instead of an empty value?

    An optional group that never took part in the match has no value at all, which is different from a group that matched an empty string. JavaScript reports the first as undefined and the second as an empty string. The tester keeps them apart because the distinction changes what your code has to handle.

    Build a better web, faster.

    We build custom software and solutions tailored to your needs.

    Get in touch