而str.replace(//-/g,"!")則可以替換掉全部匹配的字符(g為全局標(biāo)志)。

replace()
The replace() method retur " /> 国产亚洲精品精品精品,俄罗斯兽交XXXXX在线,亚洲免费精品视频

天天躁日日躁狠狠躁AV麻豆-天天躁人人躁人人躁狂躁-天天澡夜夜澡人人澡-天天影视香色欲综合网-国产成人女人在线视频观看-国产成人女人视频在线观看

JavaScript 中的replace方法說明

第一次發(fā)現(xiàn)JavaScript中replace() 方法如果直接用str.replace("-","!") 只會替換第一個匹配的字符.  
而str.replace(//-/g,"!")則可以替換掉全部匹配的字符(g為全局標(biāo)志)。  

replace()  
The replace() method returns the string that results when you replace text matching its first argument  
(a regular expression) with the text of the second argument (a string).  
If the g (global) flag is not set in the regular expression declaration, this method replaces only the first  
occurrence of the pattern. For example,  

var s = "Hello. Regexps are fun.";s = s.replace(//./, "!"); // replace first period with an exclamation pointalert(s); 

produces the string “Hello! Regexps are fun.” Including the g flag will cause the interpreter to  
perform a global replace, finding and replacing every matching substring. For example,  

var s = "Hello. Regexps are fun.";s = s.replace(//./g, "!"); // replace all periods with exclamation pointsalert(s); 

yields this result: “Hello! Regexps are fun!”  

JavaScript技術(shù)JavaScript 中的replace方法說明,轉(zhuǎn)載需保留來源!

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請第一時間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 亚洲 日韩 欧美 另类 蜜桃 | 中国女人内谢69xxxxxx直播 | 亚洲国产精品一区二区久久第 | 国模孕妇模特季玥之粉红 | 成人免费一级毛片在线播放视频 | 午夜福利院电影 | 日韩免费精品视频 | 色欲久久99精品久久久久久AV | 朝鲜黄色录像 | 久久激情网 | 無码一区中文字幕少妇熟女H | 在线成人精品国产区免费 | 亚洲AV久久无码精品九九软件 | 欧美日韩精品久久久免费观看 | 娇小8一12xxxx第一次 | 护士日本xx厕所 | 久久视频这里只精品99re8久 | 丰满五十老女人性视频 | a免费视频 | 九九99国产香蕉视频 | 最近2019年日本中文免费字幕 | 港台三级大全 | 国产精品97久久AV麻豆 | 精品人妻伦一二三区久久AAA片 | 妓女嫖客叫床粗话对白 | 97视频在线观看视频最新 | 内射人妻无码色AV麻豆去百度搜 | 亚洲午夜AV久久久精品影院色戒 | 十次啦中文网 | 久见久热 这里只有精品 | 95国产欧洲精华液 | 亚洲精品在线免费 | sm主人调教揉花蒂H SM双性精跪趴灌憋尿调教H | 九九大香尹人视频免费 | 日韩AV无码一区二区三区不卡毛片 | 精品国产自在现线拍400部 | 美女内射少妇一区二区四区 | 欧美高清一区二区三 | 色cccwww| 尤物99久久久合集一区区 | 爆操日本美女 |