Back to Tools

Regex Text Splitter

Divide text into segments using complex regular expression delimiters

SPLIT PRO
Input String
Segments Found: 0

                

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

  1. Type a delimiter pattern into Split Delimiter (Regex). The default pattern matches a comma or a semicolon with any spaces around it.
  2. Paste your text into Input String, or press Load Sample to fill in a fruit list that mixes commas and semicolons.
  3. Click Split Text.
  4. 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


Frequently Asked Questions

What delimiter pattern is pre-filled?
The field starts with a pattern that matches a comma or a semicolon, along with any spaces on either side. That means a list such as Apple, Banana; Cherry splits cleanly into three items with no stray whitespace attached.
Why are empty segments missing from the output?
After splitting, the tool removes segments that are empty or contain only spaces. This avoids blank lines when delimiters repeat or when the text begins or ends with a separator. If you need to keep empty fields, a different approach is required.
Can I use flags like case-insensitive?
This tool has no flags field, so the pattern runs without flags. For case-insensitive splitting, include both cases in the pattern, for example using a character class. Alternatively, test the pattern in the Regex Tester where flags can be set.
Why do I see the delimiter text in my results?
If the delimiter pattern contains a capturing group in parentheses, JavaScript adds the captured text into the output list. Change the parentheses to a non-capturing group by starting the group with a question mark and a colon.
How do I split by line breaks or tabs?
Enter a pattern for the separator you want, such as backslash n for newlines or backslash t for tabs, and place your text in the Input String box. You can combine several separators with the pipe symbol in one pattern.
Support Chat
We typically reply within minutes

Hello! 👋 Before we start, please tell us your name.