How do you split a string like "TheFoxRanOverTheHill" into "The Fox Ran Over The Hill" using regular expression
I've searched all over and I am not sure how you can split "TheFoxRanOverTheHill" into "The Fox Ran Over The Hill" using regular expression when there is no delimiter other than the captial letter tells you it is a start of another word. Thanks for all the replies.

Bechir BejaouiRank #144 · 15.9K reputationPosted May 4, 2009, 1:56 PM EDT
The Fox Ran Over The Hill
or you want to apply this to any kind of phrase?
asianguyinaustin5 reputationPosted May 5, 2009, 5:43 AM EDT
I want to count words in any phrase. There is no delimiter so I don't know how to indicate there are many words in a string like "TheFoxRanOverTheHill" there are 6 words in this string. The string contains no spaces.
Kirtan PatelRank #292 · 8.6K reputationPosted May 5, 2009, 1:31 PM EDT
private void button1_Click(object sender, EventArgs e)
{
string str = textBox1.Text.Trim();
Regex re = new Regex("[A-Z]*[a-z]*");
MatchCollection mc = re.Matches(str);
StringBuilder sb = new StringBuilder();
foreach (Match m in mc)
{
sb = sb.Append(" " + m.ToString());
}
MessageBox.Show("Final String is =" +sb.ToString() );
}
Happy Coding :)
asianguyinaustin5 reputationPosted May 6, 2009, 5:09 AM EDT