Regex split
Use a regular expression as the delimiter to split a string into parts. Each resulting segment is shown as a numbered list so you can inspect the structure.
MODE
How it works
The tool uses the browser's native JavaScript RegExp engine. Patterns are compiled with new RegExp(pattern, flags) and run in a Web Worker that is stopped after 2 seconds, so a runaway pattern cannot freeze the page. Invalid patterns show an error message next to the pattern and never crash the page.
Processing runs in your browser
Both the pattern and the test string are processed entirely in your browser. Our servers are not involved at any point.
Related operations
For plain substring swaps without regex, try find and replace. To validate JSON patterns you are matching, use the JSON formatter. For decoding escape sequences in HTML attribute values, see HTML entities.
Frequently asked questions
- How does split differ from replace?
- Split breaks the string at each match of the pattern and returns the parts between matches. Replace keeps all text and substitutes the matches.
- What if the pattern matches at the start or end?
- If the pattern matches at the very start, the first element will be an empty string. The same applies to a match at the end.
- Can I use capturing groups in split?
- Yes. When the pattern contains a capturing group, the captured text is also included in the result array, interleaved between the split parts.
- Do the g and y flags change a split?
- Split cuts at every match whether or not g is on, and y makes no difference either, because split already tries the pattern at each position in turn. The i, m, s and u flags still apply.
- How do I split on commas, semicolons or runs of spaces at once?
- Use a character class with a quantifier: [,;\s]+ splits a, b;c d into a, b, c and d.
Last reviewed September 30, 2026
Other pages for this tool
Related tools
- Background reading: Complete guide to developer tools