How to remove all letters from an alphanumeric string in TypeScript

1 Answer

0 votes
let str: string = "typescript 17 d 900 e 8542";
  
str = str.replace(/[^0-9 ]/gi, '');
          
console.log(str);
  
  
  
/*
run:
  
 17  900  8542
  
*/

 



answered Nov 11, 2022 by avibootz
edited 2 days ago by avibootz
...