This JavaScript function removes all non-numeric characters from a string.

function clean_num(str) {
  str = str.replace(new RegExp(/[^?0-9.]/g), "");
  return str;
}

// Example
// clean_num('Page rendered in 0.0955 seconds');
// returns => "3322955"