How to remove all non-alphanumeric characters from a string in JavaScript

1 Answer

0 votes
let str = "^ja,va 267 scr_ipt pr:og?£gr@()amm{}ing.!"; 
 
str = str.replace(/[^a-zA-Z0-9]/g, "");
 
console.log(str);
 
 
  
/*
run:
    
java267scriptproggramming
   
*/

 



answered Jul 2, 2024 by avibootz
edited 2 days ago by avibootz

Related questions

...