<div class="codetitle"> <span><a style="CURSOR: pointer" data="49377" class="copybut" id="copybut49377" onclick="doCopy('code49377')"><u>複製程式碼</u></a></span> 程式碼如下:</div> <div class="codebody" id="code49377"> <br>$(function(){ <br>var str="sunny, woo"; <br>var sear=new RegExp(','); <br>if(sear.test(str)) <br>{ <br>alert('Yes'); <br>} <br> var tag=','; <br>if(str.indexOf(tag)!=-1) <br>{ <br>alert('Yes'); <br>} <br>}); <br> </div>