把某些字符替换成**;p =/张三|李四|河南省/gi; s='我叫张三,我是河南省人'; document.write(s.replace(p,'**'));
1 p=/张三|李四/gi; 2 var s='我叫张三'; 3 if(p.test(s)){ 4 //document.write('yes'); 5 document.write(s.replace(p,'*')); 6 }else{ 7 document.write('no'); 8 }
Copyright © 2024 小蕊同学 Powered by .NET 9.0 on Kubernetes