Page 1 of 1

seperating text from numbers in a varchar

Posted: Tue Jul 09, 2002 10:44 am
by massiveone
how can i seperate characters from numbers in a varchar?
for example if i have a varchar in sql with the data hello123 how can i out put it so that it will seperate it into two variables $textstuff and $numberstuff?

anyhelp would be g8ly appreciated.

Thanks
:?:

Posted: Tue Jul 09, 2002 12:43 pm
by chris12295
the split() function in PHP will allow regular expressions so possibly:

Code: Select all

$newText = split("їA-Za-z]*ї0-9]*", $text);
$textstuff = $newTextї0];
$numberStuff = $newTextї1];
This might not work as I have not tested it but this page will explain the split function. http://www.php.net/manual/en/function.split.php

doh

Posted: Tue Jul 09, 2002 12:59 pm
by massiveone
ok code dosnt work but i get the point your make ;)
Thanks for the help