I have this code to split CamelCase by regular expression:
Regex.Replace(input, \"(?<=[a-z])([A-Z])\", \" $1\", RegexOptions.Compiled).Trim();
using Tomalak's regex with .NET System.Text.RegularExpressions creates an empty entry in position 0 of the resulting array:
Regex.Split("ShowXYZColors", @"(?=\p{Lu}\p{Ll})|(?<=\p{Ll})(?=\p{Lu})")
{string[4]}
[0]: ""
[1]: "Show"
[2]: "XYZ"
[3]: "Colors"
It works for caMelCase though (as opposed to PascalCase):
Regex.Split("showXYZColors", @"(?=\p{Lu}\p{Ll})|(?<=\p{Ll})(?=\p{Lu})")
{string[3]}
[0]: "show"
[1]: "XYZ"
[2]: "Colors"