From the category archives:

Regex

Today, I was reading Id-PHP mailing list, and I found a question for it’s member. He is asking about to insert a space before a capital letters in a string. Then, I come up with this solution. $text = “ThisIsAnExampleOfPHPString”; echo preg_replace(‘/(\B[A-Z][^A-Z]*)/’, ‘ \1′, $text); And the resut is “This Is An Example Of P…