12-06-2007, 07:47 PM
|
#2 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
I've sort of come up with a solution on my own, but it feels a little hackish with all those "OR"s in:
php Code:
$szChem = 'H2OCe5CO5L'; preg_match_all('~[^\P{Lu}]{1}[^\P{Ll}]+\d+|[^\P{Lu}]{1}\d+|[^\P{Lu}]{1}[^\P{Ll}]+|[^\P{Lu}]{1}~', $szChem, $aMatches); print_r($aMatches);
Be much easier if I could split by the uppercase letters, but still retain the uppercase letters and include them alongside the matches, as opposed to in a separate array index.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|