> For the complete documentation index, see [llms.txt](https://trizen.gitbook.io/sidef-lang/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://trizen.gitbook.io/sidef-lang/programming_tasks/m/multisplit.md).

# Multisplit

```ruby
func multisplit(sep, str, keep_sep=false) {
    sep = sep.map{.escape}.join('|')
    var re = Regex(keep_sep ? "(#{sep})" : sep)
    str.split(re, -1)
}
 
[false, true].each { |bool|
    say multisplit(%w(== != =), 'a!===b=!=c', keep_sep: bool)
}
```

#### Output:

```
["a", "", "b", "", "c"]
["a", "!=", "", "==", "b", "=", "", "!=", "c"]
```
