|
Posted by Tom on 05/04/07 18:28
On Fri, 04 May 2007 13:35:19 -0400, Patrick wrote...
>
>Hello All,
>
>Been beating my head on the wall trying to get this working. Especially
>because of my *tweener level of php and regex experience.
>
>I have this $filename = C17AA001.000
>
>I want to split it like this $a = C17AA $b = 001 $c = .000
>
>I have tried this but can't get it to work.
>
>list($a, $b, $c,) = split("^[0-9a-zA-Z]{5}[0-9]{3}\.[0-9]{3}",$filename);
>
>echo $a;
>echo $b;
>echo $c;
>
>What am I missing here? Two days of googling and php.net have not
>cleared me up.
>
>Patrick
>
>
>
>*tweener - between novice and guru
If the text is always in the format, including number of characters, the substr
function may be easier to work with...
$a = substr('C17AA001.000', 0, 4);
$b = substr('C17AA001.000', 5, 7);
$c = substr('C17AA001.000', 8, 11);
Tom
--
Newsguy.com - Basic Accounts $39.95 / 12 months
Navigation:
[Reply to this message]
|