SmartQueryTools

Extract with Regex from CSV Files Online

Extract text matching a regular expression from CSV files directly in your browser. Pull out emails, URLs, phone numbers, or any pattern into a new column — no upload required.

How to extract with Regex from CSV files

  1. Drop your file onto the upload area. The first 200 rows are shown, and the first text column is selected for you.
  2. Pick the text column to search. Only text (VARCHAR) columns are listed, so a column the reader loaded as numbers or dates will not appear.
  3. Type a regular expression, such as [A-Z]+-\d+, and name the new column. The default name is extracted.
  4. Choose First match, or All matches to join every match in a cell with a comma and a space. Click Extract.
  5. Check the new column at the end of the preview, then download the result in the same format you uploaded.

Your file is processed locally in your browser and is never uploaded. The free limit is 50 MB per file; larger files work if your device has the memory for them.

Worked example

A release manager exports the commit log for a sprint and wants a list of the Jira issue keys each commit mentions, so the release notes can link to the tickets.

Input (CSV)

commit,author,message
a41f9c2,priya,PAY-212 fix rounding in invoice totals
7be03d1,tom,Merge PAY-215 and WEB-88 hotfixes
c9d2e47,priya,Bump lodash to 4.17.21
e18a6b0,sam,web-91: tidy header spacing

Settings

  • Text column: message
  • Regex pattern: [A-Z]+-\d+
  • Output column name: issue_keys
  • Match mode: All matches (comma-separated)

Result

commitauthormessageissue_keys
a41f9c2priyaPAY-212 fix rounding in invoice totalsPAY-212
7be03d1tomMerge PAY-215 and WEB-88 hotfixesPAY-215, WEB-88
c9d2e47priyaBump lodash to 4.17.21NULL
e18a6b0samweb-91: tidy header spacingNULL

All original columns are kept and issue_keys is added at the end. The merge commit mentions two tickets, so both are joined with a comma and a space. The lodash bump has no match and gets NULL. So does web-91, because matching is case-sensitive and the pattern only allows capital letters. Start the pattern with (?i) to ignore case.

Working with CSV files

A CSV column is offered for extraction only if the reader loaded it as text. A column where every value looks like a number, such as a ticket number of 20417, is loaded as a number and is missing from the column list. Codes with leading zeros, such as 0042, stay as text because the reader keeps the zeros. Whitespace counts as part of the value. A pattern anchored with ^ will fail on a cell that starts with a space, so trim the column first if the export pads its fields.

In All matches mode each result is joined with a comma and a space. In the downloaded CSV those cells are wrapped in double quotes, so the comma does not start a new field. Cells with no match are NULL in both modes and are written as empty fields. The file is written with a header row, comma delimiters and LF line endings.

Frequently Asked Questions

Why is one of my CSV columns missing from the column list?

The reader decided it is numeric because every value looks like a number. Regex extraction only runs on text columns. Change it to VARCHAR with Cast Column Types, download, and load that file here.

Will the commas in All matches results break my CSV?

No. Any field that contains a comma, a double quote or a line break is wrapped in double quotes on export, and inner quotes are doubled. Spreadsheet apps and CSV libraries read it back as one field.

What happens when a cell has no match?

The new column holds NULL, in both First match and All matches mode. Cells that were already NULL stay NULL.

Can I extract only a capture group?

Yes. If the pattern has a capture group, the text inside the first group is returned. SKU-(\d+) returns 4471 from SKU-4471. Without parentheses the whole match is returned. Use (?:...) for grouping that should not capture.

Which regex syntax is supported?

RE2 syntax. Character classes, quantifiers, alternation, anchors and inline flags such as (?i) all work. Lookaheads, lookbehinds and backreferences are not supported and return an error. Matching is case-sensitive unless you add (?i).

Related Tools

Split Column in CSV Files Online

Split a column into multiple columns by delimiter in CSV files directly in your browser. Turn "First Last" into separate first and last name columns — no upload required.

Count Values in CSV Files Online

Group and count rows by any column in CSV files directly in your browser. Sort by frequency or value to find the most common entries — no upload required.

Filter CSV Files Online

Filter rows in CSV files by column value, directly in your browser. Your data stays on your device.

Extract with Regex from Excel Files Online

Extract text matching a regular expression from Excel files directly in your browser. Pull out emails, URLs, phone numbers, or any pattern into a new column — no upload required.

Extract with Regex from Parquet Files Online

Extract text matching a regular expression from Parquet files directly in your browser. Pull out emails, URLs, phone numbers, or any pattern into a new column — no upload required.

Extract with Regex from JSON Files Online

Extract text matching a regular expression from JSON files directly in your browser. Pull out emails, URLs, phone numbers, or any pattern into a new column — no upload required.

CSV Viewer Online

View and inspect CSV files directly in your browser. Browse rows, check column names and data types — no upload required, your data stays on your device.

Convert CSV to Parquet Online

Convert CSV files to Parquet format directly in your browser. No upload required — your data never leaves your device.