How to replace the first match substring in a string case insensitive in TypeScript

1 Answer

0 votes
let s = 'TYPEscript c++ typeSCRIPT c java c#';
 
s = s.replace(/typescript/i, 'type script');
 
console.log(s);
    
    
    
    
    
/*
run:
    
"type script c++ typeSCRIPT c java c#" 
    
*/

 



answered Feb 5, 2022 by avibootz
...