Sign up free

Regex Assistant

Write, test and understand regular expressions. Matches in a table, every part explained, replace and split, and code for 16 languages and spreadsheets.

Regex Assistant

About Regex Assistant

Regular expressions are quick to write and slow to get right. The Regex Assistant puts the whole job in one window: type the pattern at the top, paste the text on the left, and every match is marked at once and listed on the right, one column per group. Click a row to jump to it in the text. The Explain panel reads the pattern part by part in plain words and draws it as a railroad diagram.

It does more than test. Replace takes $1 and $<name>, and \U or \L to change a group's case. Split cuts the text at each match. List writes every match through a template, as CSV lines, SQL or JSON. Tests keep samples that should and shouldn't match, and run them again whenever the pattern changes. The library has more than 50 tested patterns, many for Chinese use: mobile and landline numbers, ID cards, credit codes, licence plates, email, URLs, IP addresses, dates, amounts and Chinese characters. Each comes as "check a whole value" and "find in text", with samples, and ID cards, credit codes and bank cards get their check digits verified in the table.

Everything runs in your browser; nothing you type is uploaded. A pattern that backtracks without end is stopped after a time limit, with advice on how to rewrite it. Finished patterns turn into code for JavaScript, Python, Java, C#, Go, PHP and more, or into Excel 365 and Google Sheets formulas, with warnings where a language reads the pattern differently. For many files at once, "Many files" collects the matches into one table for Excel.

How to use Regex Assistant

  1. 1
    Type the pattern

    Type a regular expression at the top, or pick one from the library, and switch flags such as global, ignore case and multiline.

  2. 2
    Add the text

    Paste text, open a file or drop one in. Matches are marked at once and listed with their groups.

  3. 3
    Choose what to do

    Switch between Match, Replace, Split, List and Tests; the result updates as you type.

  4. 4
    Copy or export

    Copy the matches, export CSV or Excel, or take the code for your language from the Code panel.

Why use Cubfile for this

  • Every part explained

    Each piece of the pattern says what it matches, drawn as a railroad diagram too. Errors point at the exact character.

  • Results as a table

    One row per match, one column per group, with position and line. Copy it straight into Excel.

  • 50+ tested patterns

    Phone numbers, ID cards, credit codes, plates, email, dates, amounts… in two versions, with samples that double as tests.

  • Replace and list

    $1, $<name>, \U upper case, \L lower case; write every match as CSV, SQL, JSON or Markdown.

  • Code for 16 targets

    JavaScript, Python, Java, C#, Go, PHP, Ruby, Rust and more, plus Excel 365, Google Sheets and MySQL.

  • Never freezes

    Patterns run on their own with a time limit, and risky nested repeats are pointed out before they bite.

FAQ

Regex Assistant: questions and answers

Is the Regex Assistant free? Do I need an account?
It's free and needs no account. Matching, replacing and exporting all happen in your browser, with no limits.
Is my text uploaded?
No. The pattern and the text stay in your browser. A shared link keeps its content after the
Which regex syntax does it use?
Patterns run in your browser's JavaScript engine. Pick Python, Java, Go, PHP, Excel or another target to see where it differs; the generated code rewrites what needs rewriting, such as Python's named groups.
Why doesn't my pattern match inside brackets I typed?
A Chinese keyboard easily types full-width ()?*+, which are plain text in a regex. The assistant points them out and turns them into half-width symbols in one click.
Can it handle several files at once?
Yes. In "Many files", pick several TXT, CSV, log or HTML files; results come with the file name and line and export to CSV or Excel.
Can the ID card pattern tell a real number from a fake one?
A pattern only checks the format and the date range. The table's Check column also verifies the final check digit, but it can't tell whether the number was actually issued.
Share Regex Assistant with a friendIt runs in any browser, and they can try it without signing up.

Related tools

TXT Regex TesterTest regular expressions with live matches and groups.
TXT Find and Replace TextReplace words in text in bulk, with regular expressions if you need them.
TXT Extract Emails, Links and NumbersPull every email, URL and phone number out of a text.
TXT Text CompareCompare two texts side by side and see every change.
DOC Article FormatterLay out articles for WeChat and more: themes, one-click tidying, a pre-publish check, then copy or export as pictures, Word or Markdown.
XLS Online Excel EditorOpen, edit and save Excel and CSV files in your browser: formulas, colours, sorting, filters and sheets.
DOC Mind Map MakerMake mind maps online: ten structures, outline view, presenting and recite mode; open and save .xmind, export Word, pictures and PDF.
PDF Online PDF EditorEdit a PDF in one window: pages, text, comments, signatures, forms, redaction and watermarks, then save or convert it.