Votey,
Not a bad solution, but I am more looking for a method using the split function. is this possible in any way?
ex: split(uppercase, $string) - is there something to put as the pattern which finds uppercases?
Main Topics
Browse All TopicsHello all!
I am working with a database that was built before my time at our company. Most of the compound field names in the tables do not separate words with special characters, they simply use uppercase to distinguish it. For example, I would want to see Delivery_Date, but we currently have DeliveryDate. For data display, it would be great to be able to split this string into two separate parts (Delivery Date). Obviously I can do this using the split function, but I can't figure out how to split on every uppercase letter.
I hope I have explained this well enough.
TIA.
- Dan
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Not quite, 'cause the delimiter generally tends to get taken out. You can get close with...
preg_split('/([A-Z])/', 'ReportGroup', -1, PREG_SPLIT_DELIM_CAPTURE);
... but that will give the 'R' and 'G' as elements of their own (i.e. [0] and [2] ), so you'd have to do some work to slap them back in front of the 'eport' and 'roup' (in [1] and [3]).
How about...
explode('_', preg_replace('/([a-z])([A-
?
That would "fail" if there were a _ in the name anyway, but really I'm betting you'd want that to get split out just the same?
This allows for any type of character before the upper case character, expect the two conditions explained below. So it allows numbers too!
<?php
$old = '#(?<!^| )([A-Z])#';
$new = ' \\1';
echo preg_replace ( $old, $new, $string );
?>
1. dont (match) the start of the string, if it has a uppper case letter
2. don't (match) a upper case letter if a (space) comes before it.
So you end up with adding a space to only the words you want to split!
ms!
Business Accounts
Answer for Membership
by: VoteyDisciplePosted on 2007-01-10 at 10:57:24ID: 18286461
How about...
Z])/', '$1 $2', $name);
$name = preg_replace('/([a-z])([A-