Curt,
That's perfect. Works like a charm.

Thanks,
Keith

At 03:54 PM 5/10/2004, Curt Zirzow wrote:
* Thus wrote hitek ([EMAIL PROTECTED]):
> 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

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to