javascript 【正则表达】
1.正则表达式
1 //search()和replace() 2 3 var str="This is a word names"; 4 5 var part=/word/i; 6 7 str.search(part); //返回寻找的位置---数字 8 9 str.replace(part,"world"); //把word替换成world
1 //test() exec() 2 var str="No Zuo No Die,Do you understand?" 3 4 var part=/understand/i; 5 6 part.test(str); //返回true; 7 8 9 part.exec(str); //返回字符串
一个二次元的生物

浙公网安备 33010602011771号