Re: Regex Help

From: Date: Mon, 10 May 2004 23:03:18 +0000
Subject: Re: Regex Help
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-185872@lists.php.net to get a copy of this message
Curt, That's perfect. Works like a charm. Thanks, Keith At 03:54 PM 5/10/2004, Curt Zirzow wrote:
* Thus wrote hitek (hitek@cox.net): Greetings list, I have been given a list of products, and I need some help building a regular expression to split the category from the sub category. Example: CamerasDigital_CannonXLRshot <-Original entry in list Cameras Digital Cannon XLRshot <-Desired result. One possiblity: echo preg_replace('/([a-z])_?([A-Z])/', '$1 $2', 'CamerasDigital_CannonXLRshot'); explanation: match a lower case character preceding an uppercase character, with an optional underscore between them. Replace that match with the matched lowercase character, space and matched uppercase character. Curt -- "I used to think I was indecisive, but now I'm not so sure." -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php


« previous php.general (#185872) next »