How to remove all special characters from a string in Typescript

1 Answer

0 votes
let s = '2a1 -0/R@ a9f#4;;typeK$$cCK ^htPa  m8vscriptlWhJ';
  
s = s.replace(/[^a-zA-Z0-9 ]/g, "");
  
console.log(s);
  
  


  
/*
run:

"2a1 0R a9f4typeKcCK htPa  m8vscriptlWhJ" 
  
*/

 



answered May 1, 2022 by avibootz
...