12-06-2007, 06:38 PM
|
#1 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
...Another regular expression problem!
I have the following code at the moment:
php Code:
$szChem = 'H2OCe'; $aMatches = preg_split('~([^\P{Lu}]+)~', $szChem, null, PREG_SPLIT_DELIM_CAPTURE ); print_r($aMatches);
Which outputs:
Code:
Array
(
[0] =>
[1] => H
[2] => 2
[3] => O
[4] =>
[5] => C
[6] => e
)
I could remove the flag PREG_SPLIT_DELIM_CAPTURE but I want the uppercase character I'm splitting it on. So if things were going right for me the array would look like so:
Code:
Array
(
[0] => H2
[1] => O
[2] => Ce
)
But I just can't seem to get it. Any ideas?
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
Last edited by Wildhoney : 12-06-2007 at 07:10 PM.
|
|
|