Given a string S1, replace "\n", using str_replace(), with a special token " xx--99---2 ", where the special token has both a leading and trailing blank, to give string S2. Now explode S2, and do your operation on the exploded result. but be careful that the operations done will not affect the special token. Subsequently implode the new results to give the string S3. Finally replace the special token using str_replace(), with "\n" to give S4, and your task is complete.
Knowledge is that which can be shown to be the case, and Intelligence is the method one uses to deploy the demonstration of what is the case, everything else is Information.
Hmm...think I missed the part about only all-caps words. That looks like a good solution, though there might be some edge cases that could be problematic, such as the name "MACTAVISH", which should normally be spelled "MacTavish". (And we won't even try to figure out to do with "Dupont", "DuPont", "duPont", "Du Pont", or "du Pont". )
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation