Regex Splitter

Paste text and a pattern for the separator, and get every piece on its own line. A regular expression lets you split on several separators at once, such as a comma, semicolon or pipe with any spaces around it, which a plain split cannot do. Trim spaces, drop empty pieces, keep the separators or stop after a number of pieces.

Tool

JavaScript syntax. You can also paste /pattern/flags.

Text inside ( ) in the pattern

6 pieces

Splitting runs in your browser. What you type never leaves this device.

Features

  • Split on any JavaScript regular expression, such as \s*[,;|]\s* or \n{2,}

  • Trim spaces around each piece and drop empty ones

  • Keep the separators as separate items by wrapping them in ( )

  • Limit the number of pieces

  • Ignore case, multiline, dot-all and Unicode flags

  • A count of the pieces, and one-click copy

What you can split

Messy lists

Turn "Mumbai, Pune; Nagpur | Nashik" into a clean one-per-line list for a spreadsheet, a dropdown or a bulk upload.

Paragraphs and sentences

Split on blank lines (\n\s*\n) to get paragraphs, or on [.!?]\s+ to get rough sentences for review or translation.

Log lines and codes

Break log entries, SKUs like AB-12/CD-34 or tags written with mixed separators into their parts.

Useful split patterns

Common separators

  • Comma, semicolon or pipe with optional spaces: \s*[,;|]\s*
  • Any run of whitespace, including tabs and new lines: \s+
  • Blank lines between paragraphs: \n\s*\n
  • Sentence ends: (?<=[.!?])\s+ (keeps the full stop with the sentence)
  • Camel case boundaries: (?=[A-Z]) splits getUserName into get, User, Name

Keeping the separators

When the pattern has capture groups in brackets, tick "Keep captured separators" to include whatever they matched as their own items. For example ([+-]) on 1+2-3 gives 1, +, 2, -, 3. Use (?: ) for groups you do not want to keep.

Regex Splitter - FAQ