I have a number of strings which contain words which are bunched together and I need to seperate them up.
For example
ThisWasCool - This Was Cool
MyHomeIsHere -
I'm not proficient with regular expression but I would suggest something like the following code:
$string="ThisWasCool to visit you again";
$temp = explode(' ',$string, 2);
$temp[0] = preg_replace('/(.)([A-Z])/','$1 $2', $temp[0]);
$string = join(' ',$temp);
Looking at SirLancelot code I've got a second solution. Still I prefer the explode solution as you stated that your target it is only the first word of the string.
$string="ThisWasCool to visit you again";
$temp = explode(' ',$string, 2);
$temp[0] = preg_replace('/(?