Regex Text Splitter
Divide text into segments using complex regular expression delimiters
Break text apart where a pattern matches
Splitting on a single comma is easy in any spreadsheet. Real data is messier: a list might use commas in some places, semicolons in others, with random spaces around both. A regular expression delimiter handles all of that in one rule. This tool takes your input string, cuts it wherever the delimiter pattern matches, and prints the pieces one per line with a count.
Splitting text in four steps
- Type a delimiter pattern into Split Delimiter (Regex). The default pattern matches a comma or a semicolon with any spaces around it.
- Paste your text into Input String, or press Load Sample to fill in a fruit list that mixes commas and semicolons.
- Click Split Text.
- The results panel reports Segments Found and shows each segment on its own line. Press Copy List to copy them.
How the split behaves
The tool uses the standard string split with your pattern as the separator. After splitting, any segment that is empty or contains only whitespace is dropped, so consecutive delimiters do not create blank lines. The delimiter itself is not kept in the output, unless your pattern contains a capture group, in which case JavaScript includes the captured delimiter text as extra items between the segments. Keep that in mind and use a non-capturing group when you only want the pieces.
When this is useful
- Turning a pasted tag list with inconsistent separators into a clean column.
- Breaking a log line at every pipe or tab to inspect its fields.
- Splitting a paragraph into sentences using a pattern that matches end punctuation followed by whitespace.
- Converting a semicolon-separated address string into individual lines for a mailing label.
Limits and gotchas
There is no flags box in this tool, so the pattern is used without flags. Matching is case-sensitive, and the dot does not cross line breaks. If you need case-insensitive delimiters, write both cases in a character class, such as a bracket containing both an upper and a lower case letter. Nothing happens if either the input or delimiter field is empty. An invalid expression triggers an alert that includes the engine's message. Because whitespace-only pieces are discarded, you cannot use this tool to preserve intentionally blank entries.
Segments are not trimmed automatically apart from what the delimiter itself consumes. That is why the default pattern includes optional whitespace on both sides of the separators, so leading and trailing spaces disappear from each item. The work is performed with JavaScript in your browser.
Related Tools
Related Tools