I made this a while ago. It matches each component of a CamelCase name.
/([A-Z]+(?=$|[A-Z][a-z])|[A-Z]?[a-z]+)/g
For example:
"SimpleHTTPServer" => ["Simple", "HTTP", "Server"]
"camelCase" => ["camel", "Case"]
To convert that to just insert spaces between the words:
Regex.Replace(s, "([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z]))", "$1 ")
If you need to handle digits:
/([A-Z]+(?=$|[A-Z][a-z]|[0-9])|[A-Z]?[a-z]+|[0-9]+)/g
Regex.Replace(s,"([a-z](?=[A-Z]|[0-9])|[A-Z](?=[A-Z][a-z]|[0-9])|[0-9](?=[^0-9]))","$1 ")
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…