I have a small problems with regex and php.
This is what i have:
8 Ball Script S Caps S S K
This is what i want:
8 Ball Script S Caps SSK
In short i need to correct every abrivations in the string dynamicly. wherever in the string that i can find something like “A B R I V”, it needs to remove the spaces “ABRIV” without screwing with everything else in the string. So that i can have a string that is something like “H I, Hello F O O World, i have B A C O N” should become “HI, Hello FOO World, i have BACON”.
This is my code so far:
$string = preg_replace("/(?<= )[A-Z](?![a-z]).(?![A-Za-z]+[a-z])/", '$0', $string);
This seems to do what you want:
see a demo on ideone.com