I\'ve been tinkering with small functions on my own time, trying to find ways to refactor them (I recently read Martin Fowler\'s book Refactoring: Improving the Design of Ex
The Regex versions of your solution are not equivalent in results to the original code. Perhaps the larger context of the code avoids the areas where they differ. The original code will add a space for anything that is not a lower case character. For example "This\tIsATest"
would become "This \t Is A Test"
in the original but "This\t Is A Test"
with the Regex versions.
(?
Is the pattern you want for a closer match, but even then it is still ignoring issues of i18n. The following pattern should take care of that:
(?