Codice PHP:
$numeri preg_replace('/[^\\d]+/'''$str);