Note: several of the folks used "/" as the delimiter. Actually, it can be almost anything that will not be in the
$string. Generally, I use "%" simply because it's easier to spot when I forget the delimiters.
Also, note Robin's use of the metachar [[:upper:]]. metacharacters can very useful. My favorites are [:punct:] and
[:space:]
Dotan Cohen wrote:
On 25/04/07, Robin Vickery <robinv@xxxxxxxxx> wrote:
$string = preg_replace('/(?<=\w)([[:upper:]])/', ' $1', $string);
turns "this is OpenSourceCode" to "this is Open Source Code"
Another great solution, Robin, thanks. I've learned a LOT from this thread.
Dotan Cohen
http://what-is-what.com/what_is/open_office.html
http://hardtofindlyrics.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php