Posted by John Nichel on 01/19/06 18:28
Chris Boget wrote:
> I've been beating my head against the wall for a while trying to come up
> with the RE I need to use. I have a camel case word - let's use
> JimJoeBobBriggs. I need to come up with a RE that will fine all the
> upper case characters and insert an underscore prior to those characters
> with the exception of a possible first character. So using the
> aforementioned word, the RE would change it to Jim_Joe_Bob_Briggs.
>
>
>
> Any help would be greatly appreciated!
preg_replace ( "/(.)([A-Z])/", "\1_\2", $string );
--
John C. Nichel IV
Programmer/System Admin (ÜberGeek)
Dot Com Holdings of Buffalo
716.856.9675
jnichel@dotcomholdingsofbuffalo.com
Navigation:
[Reply to this message]
|