Codice PHP:
$stringa "a1..zsafd243,2";
$risultato ereg_replace("[^0-9]","",$stringa);
echo 
$risultato;
// ottieni "12432"