Re: how to add a space using a regex



"William James" <w_a_x_man@xxxxxxxxx> wrote:

>
> Jerry Preston wrote:
>> What I want to do is add a space between one's name when the are
>> like the following:
>>
>> $name1 = "FirstLast:";
>>
>> I want change $name1 = "First Last";
>>
>> and
>>
>> $name1 = "FirstMiddleLast:";
>>
>> I want change $name1 = "First Middle Last";
>>
>> To be able to add spaces for either "FirstLast:" or
>> "FirstMiddleLast:" with the same regex?
>
> In Ruby:
>
> name1.gsub!(/(.)([A-Z])/,'\1 \2')


Why would you think a Ruby solution would be of interest here?


--
Cheers,
Bernard
.