<div class="codetitle"> <span><a style="CURSOR: pointer" data="30103" class="copybut" id="copybut30103" onclick="doCopy('code30103')"><u>複製程式碼</u></a></span> 代碼如下:</div> <div class="codebody" id="code30103"> <br>var s="abachdas"; <br>var s2=s. replace(new RegExp(/(a)/),'b');//將s中所有a替換成b <br> </div>