摘要:
1 function testNum(str){ 2 var reg = new RegExp("^[^0-9]*$");//从头到尾都不是数字 3 if(reg.test(str)){ 4 alert("没有数字!"); 5 }else{//有数字 6 var reg = new Reg... 阅读全文
摘要:
//从字符串'Is this all there is'中剪去'is': var str='Is this all there is'; var subStr=new RegExp('is');//创建正则表达式对象 var result=str.replace(subStr,"");//把'is'替换为空字符串 console.log(result);//Is th all ... 阅读全文