How to replace all the matched numbers in a string using regex in JavaScript

1 Answer

0 votes
var s = "javascript01223c++3php500--9_8";

s = s.replace(/\d+/g, "*");

document.write(s); 

 
 
  
/*
run:
   
javascript*c++*php*--*_* 
      
*/

 



answered Aug 3, 2019 by avibootz
...