How to case insensitive replace a substring in a string in Node.js

1 Answer

0 votes
let str = "node.js php java c c++ java";

str = str.replace(/JAVA/gi, '****');

console.log(str);
    
    
    
    
/*
run:
    
node.js php **** c c++ ****
    
*/

 



answered Jul 12, 2022 by avibootz
...