How to case insensitive replace a substring in a string in TypeScript

1 Answer

0 votes
let str = "typescript php python c c++ python";

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

console.log(str);
    
    
    
    
/*
run:
    
"typescript php ****** c c++ ******"  
    
*/

 



answered Jul 12, 2022 by avibootz
...