How to remove all characters from a string except numbers in Node.js

1 Answer

0 votes
let str = 'javascript991c# 20 typescript 640node.js';

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

console.log(str);

  
  
  
  
/*
run:
  
99120640
  
*/

 



answered Jul 10, 2022 by avibootz
...