How to remove all characters from a string except numbers in TypeScript

1 Answer

0 votes
let str = 'javascript981python 88 typescript 1000node.js';

str = str.replace(/\D/g, '');

console.log(str);

  
  
  
  
/*
run:
  
"981881000" 
  
*/

 



answered Jul 10, 2022 by avibootz
...