Using $regsub

Code:
alias numonly {
  var %a = $1-
  !.echo -q $regsub(%a,/[^0-9]/g,,%a)
  return %a
}


Using $regsubex

Code:
alias numonly {
  var %a = $1-
  return $regsubex(%a,/[^0-9]/g,)
}


[0-9] will match any digit, by adding the ^ it means to match anything except a digit. The /g modifier is used to find all matches in the string.