What does splitting by regex mean?
Splitting by regex cuts text into pieces wherever a regular expression matches, rather than at one fixed character. It's the reliable way to break apart lists typed by people, tags pasted from different tools, and log fields separated by varying amounts of space.
Type the separator pattern and optional flags, decide whether to trim pieces and drop empty ones, and choose how to join the result: one per line, comma separated, tab separated for spreadsheets, or a JSON array for code. Counts show the pieces kept and the empty ones dropped.
How to use the Split text by regex
1.Paste the text
A list, a log line or any delimited text.
2.Write the separator pattern
The default splits at commas, semicolons and pipes.
3.Choose the output
Lines, commas, tabs or a JSON array.
Example: a messy fruit list
"apples, pears;bananas | grapes, oranges;;kiwis" split with \s*[,;|]\s*:
- Pieces
- 6: apples, pears, bananas, grapes, oranges, kiwis
- Empty dropped
- 1 (from the double ;;)
A clean list whatever separators the person typing chose.
Patterns beat single characters
A plain split only handles one separator. A pattern such as \s*[,;|]\s* handles all three and swallows surrounding spaces in one go; \s+ splits on any run of whitespace; \r?\n\s*\r?\n splits paragraphs.
Back-to-back separators create empty pieces, which can be dropped, and every piece can be trimmed. If the pattern contains capture groups, the captured separators are included in the result, as JavaScript's split does. Splitting runs instantly on long text, so pasting a whole log file is fine.
Frequently asked questions
How do I split on words like AND?
Use \s+and\s+ with the i flag to ignore case.
Can I keep the separators?
Yes. Wrap the pattern in a capture group, like ([,;]).
How do I make a JSON array?
Set Join with to JSON array.
Is the text saved?
No. It isn't stored anywhere.
Related tools
Regex match extractor
List every regex match or capture group in text, as lines or CSV.
Regex Tester
Test JavaScript regular expressions with live highlighting, groups and replace.
Sort Lines Alphabetically
Sort a list A–Z, Z–A, by number or length, reverse or shuffle it.
Text Diff Checker
Compare two texts by line, word or character and see what changed.
Cron Expression Explainer
Translate a cron schedule into plain English and see its next run times.
Lorem Ipsum Generator
Placeholder text by paragraph, sentence or word, plain or in <p> tags.
More Developer tools
JSON & data
CSV tools
Network & system
Web & API
Git & releases
Encoding & security
- Base64 encode & decode
- URL encode & decode
- JWT decoder
- Hash generator
- HTML entity encoder
- Text to binary
- Morse code translator
- Caesar cipher & ROT13
- Random string generator
- Secret key generator
- 2FA code generator (TOTP)
- Encrypt & decrypt text
- Encrypt & decrypt files
- SSH key generator
- Base32 encoder and decoder
- Unicode escape converter
- Nano ID generator
- JWT generator