Regex Capture Groups to CSV

Paste text, write a regex with named capture groups, and get spreadsheet-ready CSV — one row per match, group names as the header. Choose the delimiter, quoting, and column order, dedupe or sort rows. Runs in your browser; nothing is uploaded.

Try:
CSV

About this tool

Regular expressions are great at finding things in messy text; spreadsheets are great at everything after that. This tool joins the two: it runs your pattern over the whole input and writes one CSV row per match, using the pattern's capture groups as columns.

Name your groups — (?<name>…) or (?P<name>…) — and those names become the header row. A pattern with plain unnamed groups gets column1, column2, … instead, and a pattern with no groups at all produces a single match column holding each whole match, so any regex you already have works without editing.

Everything runs locally in your browser: the text you paste never leaves the page.

Worked example

Input text:

2026-07-20 14:03:11 ERROR auth Failed login for alice
2026-07-20 14:03:15 INFO http GET /health 200

Pattern:

(?<date>\S+) (?<time>\S+) (?<level>[A-Z]+) (?<module>\S+) (?<message>.*)

Output CSV (default settings — comma delimiter, header on, minimal quoting):

date,time,level,module,message
2026-07-20,14:03:11,ERROR,auth,Failed login for alice
2026-07-20,14:03:15,INFO,http,GET /health 200

Set Columns to level, message to emit just those two, in that order. Switch the delimiter to tab for TSV, or line endings to CRLF when the file is headed for Excel on Windows.

What you can control

Limits and edge cases

FAQ

How do I name the columns in my CSV?

Name the capture groups. (?<ip>\S+) (?<status>\d{3}) produces a CSV with the header ip,status. Both syntaxes are accepted — (?<name>…) and (?P<name>…). If you would rather keep the pattern untouched, leave the groups unnamed and the columns come out as column1, column2, … which you can rename in your spreadsheet.

What happens to commas, quotes, and newlines inside a captured value?

They are escaped properly. A field containing the delimiter, a double quote, or a line break is wrapped in double quotes, and any quote inside it is doubled — so say "hi", now becomes "say ""hi"", now". That is the RFC 4180 convention every spreadsheet understands. Choose All fields quoted if your downstream tool prefers a uniformly quoted file.

Can one row come from text that spans several lines?

Yes. The pattern is applied to the whole input, not line by line. Turn on Dot matches newlines so . crosses line boundaries, and a pattern like <td>(?<cell>.+?)</td> will capture a cell whose content is wrapped over two lines. The captured newline is preserved inside a quoted CSV field.

Why do I get "no matches" when the pattern looks right?

The usual causes are case (turn on Ignore case), anchors (^ and $ only match the very start and end of the text unless Multiline is on), and . not crossing line breaks (turn on Dot matches newlines). Also remember that backreferences and lookaround are not supported by this regex engine — a pattern copied from a PCRE tester that uses (?=…) will fail to compile and you will get an "invalid regular expression" error instead.

How do I get a TSV, or a file Excel opens cleanly?

Set the delimiter to tab for TSV. For Excel on Windows, set line endings to CRLF; keep the header row on so the columns are labelled. If your data contains semicolons and your locale's Excel splits on semicolons, pick a different delimiter — any single character is allowed.

Is the same thing available on the command line?

Yes — every tool here is also a CLI command with the same parameters, so a pattern you tuned on this page can be dropped straight into a script or piped into another tool. The page shows the exact command for the values you have entered.

Developer & Automation Access

Run it from the terminal

Same engine as this page, headless — via the gizza CLI:

gizza tool regex-capture-to-csv "10.0.0.5 GET /index.html 200
10.0.0.9 POST /api/login 401" 'pattern=(?<ip>\S+) (?<method>[A-Z]+) (?<path>\S+) (?<status>\d{3})'

New to the CLI? Get gizza →

Open it by URL

Pre-fill and auto-run this tool with query parameters — the names match the API/CLI:

https://gizza.ai/tools/regex-capture-to-csv/?text=10.0.0.5%20GET%20%2Findex.html%20200%0A10.0.0.9%20POST%20%2Fapi%2Flogin%20401&pattern=%28%3F%3Cip%3E%5CS%2B%29%20%28%3F%3Cmethod%3E%5BA-Z%5D%2B%29%20%28%3F%3Cpath%3E%5CS%2B%29%20%28%3F%3Cstatus%3E%5Cd%7B3%7D%29&columns=status%2C%20ip&delimiter=%2C%20or%20tab%2C%20semicolon%2C%20pipe&header=true&quoting=minimal&line_ending=lf&ignore_case=true&multiline=true&dotall=true&unique=true&sort=true

Machine-readable descriptor: tool.json — title + parameters JSON Schema for agents.