# String.split on a sub-string within a pattern?

**URL:** <https://forum.elixirforum.com/t/string-split-on-a-sub-string-within-a-pattern/2133>\
**Category:** Questions\
**Tags:** regexp, exercism\
**Created:** [October 26, 2016, 12:31pm UTC](https://forum.elixirforum.com/t/string-split-on-a-sub-string-within-a-pattern/2133 "2016-10-26T12:31:36Z")\
**Posts on this page:** 1\
**Showing post:** 12

<div class="post-metadata">

**Author:** ![tallakt](https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/tallakt/32/942_2.png) [@tallakt](https://forum.elixirforum.com/u/tallakt)\
**Post date:** [October 27, 2016, 4:56pm UTC](https://forum.elixirforum.com/t/string-split-on-a-sub-string-within-a-pattern/2133/12 "2016-10-27T16:56:42Z")

</div>

`\B` matches non word boundary, ie. not at the beginning of a word

```elixir
iex(9)> for s <- ["abcde", "a b cde"], do: String.split(s, ~r(\Bb|\s))
[["a", "cde"], ["a", "b", "cde"]]

```

---

_[View the full topic](https://forum.elixirforum.com/t/string-split-on-a-sub-string-within-a-pattern/2133)._
