I'm currently trying to split a string into its pieces using this:
var output = Regex
.Split(input, @"(?<=[)])\s*|\s*(?=[(])")
.Where(s => s != string.Empty)
.ToList();
The input string is: "hmmmmmmmm (red,asdfhqwe) asasd"
The wanted output is: "hmmmmmmmm "
, "(red,asdfhqwe)"
, " asasd"
.
the output I'm getting is: "hmmmmmmmm"
, "(red,asdfhqwe)"
and "asasd"
.
How can i include the spaces when splitting?