vasilenko.info

Regular expression tester

/en/tool/regex-tester/ works Checks in the browser

Enter a pattern and text — matches are highlighted immediately, with group numbers and positions. An explanation appears beside it: each part of the expression is shown on a separate line, with an explanation in Russian of what it does. PCRE, Python, Go, .NET, and Java syntax is translated automatically, and differences between engines are listed. The pattern runs in a separate thread with a time limit, so the tab will not freeze, even with an expression containing nested quantifiers.

promoTwenty years of notes on websitesHow we did it in 2008 and what still works today.Open

Pattern and text

Engine

The expression is still executed by the browser engine — the page does not have its own PHP or Python. But syntax from another engine is converted into a form the browser understands, and anything that cannot be converted is listed separately below the analysis.

Flags

Group positions use the d flag — it is always enabled and needs no toggle.

The expression body without slashes around it. Set flags using the toggles above. The pattern analysis and syntax highlighting are in the section below.

Syntax cheat sheet — insert character Collapse cheat sheet

Ready-made pattern

    Sets both the expression and suitable text for testing — no rewriting needed.

    Drop a text file here — or choose one

    Text up to 200,000 characters is highlighted as well. Beyond that, highlighting is disabled, but search and the matches table work up to 8 MB.

    What to do with the text

    Matches — highlighting and table. List — only the matching text, one line each. Replace — the complete replacement result. Split — what remains between matches.

    Matches in text

    highlighted

    Done JavaScript

        Matches
        Groups in pattern
        Characters in text
        Start probes
        Parsing took

        The pattern runs on your device, in a separate thread, with a time limit. Neither the pattern, the text, nor the file you dragged here is sent anywhere: after loading, the page makes no network requests.

        Pattern breakdown

        The expression is broken down into parts: each line shows a piece of the pattern and what it does. Hover over a line in the breakdown to highlight the corresponding piece in the pattern. The group color here matches its column in the matches table.

        pattern

        How your engine differs from the browser

        All matches

        A table of all matches: position, length, and the contents of each group. You can copy columns individually or export the entire table as a file.

        Row order
        Matches

        Copy one column

        Ready-to-use code

        The same pattern, flags, and mode, already inserted into code with the correct quotes, separators, and escaping. No manual rewriting needed.

        Language
        regex.js

        Pattern stability

        The pattern runs on strings of increasing length made from a repeating character. If the time grows faster than the length, this expression will eventually hang the process on production text. The check runs in a separate thread: a stuck attempt is stopped, and the page stays responsive.

        Not checked

        promoCalculate ROI at the same timeCampaign payback based on spend and revenue.Open

        How to use it

        1. Choose a ready-made pattern or enter your own

          The “Ready-made pattern” row includes email addresses, phone numbers, TIN, SNILS, URL, IPv4 and IPv6, dates, times, HEX colors, UUID, card numbers, domains, and license plates. Each preset fills in both an expression and test text, so nothing needs to be rewritten. Enter your own pattern without slashes around it: not «\/\d+\/g», but «\d+»; set the g flag with the switch.

        2. Choose an engine if you're not writing in JavaScript

          PCRE (PHP), Python re, Go RE2, .NET, and Java handle named groups, text boundaries, and lookarounds a little differently. Choose your engine—the notation will be translated automatically, and anything that can't be translated will be listed separately below the breakdown for review. The browser runs the expression anyway: the page has no PHP of its own, so there's no point pretending otherwise.

        3. Read the pattern breakdown

          The “Pattern breakdown” section splits the expression into parts and labels each one in plain English: “\d{4} — exactly four digits,” “(?: — groups without taking a number,” “(?<= — lookbehind.” Hover over a breakdown row to highlight the corresponding part in the pattern. If the expression fails to compile, a caret appears below the pattern exactly where the engine stopped.

        4. Switch to the mode you need

          “Matches” highlights matches and displays them in a table. “List” shows only the matched text, one match per line—a convenient way to extract all addresses from a wall of text. “Replace” shows the complete replacement result. “Split” shows what remains between matches, as with split. The generated code at the bottom of the page changes with the mode.

        5. Download the result or share it by link

          The match table exports the entire result to TXT, CSV, and JSON—not just the first thirty rows. The “Link to this breakdown” button puts the pattern, flags, text, and replacement string into the page URL. Send the link to a colleague, and they will see exactly the same thing.

        6. Check your pattern for stability

          The button in the “Pattern stability” section runs the expression against strings of increasing length and plots how the execution time grows. Linear growth means the pattern is safe. A fourfold increase in time when the length doubles indicates quadratic growth. A jump by several times indicates the kind of expression that could eventually take down a server with a request from a form.

        promoBrowser task listNo account required—everything is stored on your device.Open

        The formula and what it includes

        engine + pattern + flags + text → matches, groups, and positions

        The browser engine executes the expression. PCRE, Python, Go, .NET, and Java syntax is converted to its format: «(?P<name>» becomes «(?<name>», «\A» and «\z» become lookarounds at the text boundaries, «\h» and «\R» become character sets, and the atomic group «(?>» becomes a regular group. Unsupported features—recursion, conditional groups, and possessive quantifiers—are listed below the explanation so you do not discover this in production.

        Example breakdown: dates in year-month-day format

        The input data is the same as the default field values: you can calculate it mentally and confirm that the tool is telling the truth.

        1. The pattern breakdown shows seven rows: three groups, each containing “\d” with a repetition count, separated by two hyphens.

        2. The pattern contains three pairs of parentheses, so it has three groups: year, month, and day. Each has its own column and color in the match table.

        3. Each date has 10 characters: four digits, a hyphen, two digits, a hyphen, and two digits.

        4. The first match starts at position 6: the word «Релиз» takes five characters, followed by a space.

        5. The replacement swaps the groups and uses periods instead of hyphens.

        3 matches and 3 groups are found. The first is 2026-08-17 at position 6, and group 1 has its own position range, 6–10. After replacement, the first line looks like this: Релиз 17.08.2026, откат 19.08.2026. In the «Ready-to-use code» section, the same pattern is already inside preg_replace with a suitable delimiter.

        Frequently asked questions

        promoAll toolsForty-four tools, all running in your browser.Open

        Related tools

        6

        MD5 and SHA hashes

        Calculates MD5, SHA-1, SHA-256, and SHA-512 hashes for a string or file.

        Open

        Password generator

        Creates passwords of the required length and assesses how difficult they are to crack.

        Open

        Timestamp converter

        Converts Unix time to a date and back, taking the time zone into account.

        Open