请教:正则replace问题!如一个字符串"aaabbcc",想替换bb为其他如kk,用replace正则怎么做?
请教:正则replace问题!如一个字符串 "aaabbcc ",想替换bb为其他如kk,用replace正则怎么做?
------解决方案-------------------- <SCRIPT LANGUAGE= "JavaScript ">
<!--
var str = "ssaaabbccc "
alert(str.replace(/aaa(.*?)ccc/g, "aaaKKccc "))
//-->
</SCRIPT>
------解决方案--------------------str.replace(/(a{3})(b{2})(c{2})/ig, '$1KK$3 ')