Regex Text Splitter

Split text using a regular expression as the delimiter — runs of whitespace, several separators at once, blank lines between paragraphs, or any pattern a plain character cannot express. Add a second pattern to split each row into fields and get a table. Output as lines, JSON, CSV, TSV, numbered or a custom join. Nothing is uploaded.

Try:
Parts

About this tool

Most splitters ask for a single character. Real pasted data rarely cooperates: columns are separated by runs of spaces and tabs, a list mixes commas and semicolons, records are divided by blank lines, or the delimiter is a word rather than a symbol. This tool takes a regular expression as the separator — everything between matches of your pattern becomes a part.

Note the direction: the pattern describes the delimiter, not the data. \s+ splits on whitespace; it does not extract whitespace. If you want the matches themselves, that is a different job (matching, not splitting).

Add a field pattern and each row is split again, so delimited text becomes a real table you can render as CSV, TSV or nested JSON. Everything runs locally in your browser — the text you paste never leaves the page.

Worked example

Input text:

host:   web1
region: eu-west
role:   api

Split pattern \n, field pattern \s*:\s*, output CSV:

host,web1
region,eu-west
role,api

Leave the field pattern blank and the same input with pattern \n gives one line per row instead. Switch the output to JSON array and you get [["host", "web1"], …] — nested arrays once a field pattern is set, a flat array of strings without one.

What you can control

Limits and edge cases

FAQ

How is this different from splitting on a plain character?

A plain delimiter has to match exactly. If your data is separated by two spaces in one place and a tab in another, a literal split leaves empty parts and ragged columns. The pattern \s+ treats any run of whitespace as one separator, and [,;|] accepts three different delimiters in the same input. Anything you can describe as a regex works — including multi-character separators like , or --, and word separators like \s+then\s+.

How do I split into columns as well as rows?

Set the split pattern to whatever divides your records — usually \n — and the field pattern to whatever divides the values inside a record, such as \s*:\s*, \t or \s{2,}. Then pick CSV, TSV or JSON as the output format. Without a field pattern the tool produces a one-dimensional list of parts.

Why do I get an empty first or last part?

Because the text begins or ends with the separator. Splitting ,a,b, on , produces four parts: an empty one, a, b, and another empty one. That is correct split behaviour, not a bug — turn on remove empty parts to drop them, and trim each part if the parts also carry stray spaces.

Which regex syntax is supported?

Rust's regex syntax: character classes, quantifiers, groups, alternation, anchors, Unicode classes like \p{L}, and inline flags. It is a linear-time engine, so backreferences and lookaround ((?=…), (?<=…)) are not supported — a pattern using them returns an "invalid pattern" error naming the problem. The i, m and s flags are available as checkboxes rather than inline flags, though inline forms like (?i) work too.

What does max splits do?

It caps how many times the input is cut into rows, keeping everything after the last cut as the final part. This is the classic "split off the first N fields" behaviour: with pattern :\s* and max splits 1, the line ERROR: disk full: /dev/sda1 becomes ERROR and disk full: /dev/sda1 instead of three parts. 0 means unlimited. Field splitting is never capped.

Is my text uploaded anywhere?

No. The splitter is compiled to WebAssembly and runs entirely inside your browser tab, so the text never leaves your machine. The same engine is available offline through the command line, which is useful for files bigger than the page's limit.

Developer & Automation Access

Run it from the terminal

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

gizza tool text-splitter-regex "alpha   beta		gamma
delta,epsilon" 'pattern=\s+'

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/text-splitter-regex/?text=alpha%20%20%20beta%09%09gamma%0Adelta%2Cepsilon&pattern=%5Cs%2B&field_pattern=%5Cs%2A%3A%5Cs%2A&output=lines&separator=%2C%20or%20%5Cn%5Cn%20or%20---&max_splits=0&ignore_case=true&multiline=true&dotall=true&trim=true&remove_empty=true

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