Forum Moderators: coopster
$string = "ABC123";
$number = preg_replace('/[^0-9_]/i','',$string);
$code = preg_replace('/[^a-z_]/i','',$string);
something like that?
$matches = array();
$pattern = "/([A-Z]+)([0-9]+)/";
preg_match_all($pattern,$string,$matches);
echo '<pre>';
print_r($matches);
echo '<pre>';
Good luck! :)
$number = preg_replace('/[^0-9_]/i','',$name);
$code = preg_replace('/[^a-z_]/i','',$name);
However it replaces all numbers in the string, but i have realised that some of the codes contains numbers i.e.
IDHG2HG10
code = IDHG2HG
number = 10
ID2H3
code = ID2H
number = 3
I need to be able to get the number after the code only which may contain numbers :D confusing i know