而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)系我們修改或刪除,多謝。

主站蜘蛛池模板: 成人在线观看视频免费 | 国产精品ⅴ视频免费观看 | 亚洲欧洲久久 | 国产爱豆果冻传媒在线观看视频 | 成人高清护士在线播放 | 精品久久久久中文字幕加勒比东京热 | 久久久久国产一级毛片高清片 | 亚洲伊人精品综合在合线 | XXX欧美性兽交 | 国产成A人片在线观看 | 国产精品永久免费视频观看 | 99精品视频在线免费观看 | 哪灬你的鸣巴好大 | 国产精品v欧美精品v日韩 | 国产成人自拍视频在线观看 | 久久国产av偷拍在线 | 国产福利一区二区精品 | 91精品国产色综合久久 | 国产精品人妻无码久久久2022 | 神马影院在线eecss伦理片 | 在线观看亚洲AV无码每日更新 | 亚洲 日韩 欧美 国产专区 | 久久国产精品无码视欧美 | 99热这里只有精品 | 欧美亚洲日韩自拍高清中文 | 91久久偷偷做嫩草影院免 | 99久久免费视频6 | 出轨的妻子在线观看 | 吃奶吸咪咪动态图 | 99麻豆精品国产人妻无码 | 欧美精品成人a多人在线观看 | 午夜阳光影院在线观看视频 | 中国午夜伦理片 | 国产小伙和50岁熟女23p | 国产精品无码亚洲精品 | 无码日韩人妻精品久久蜜桃入口 | 亚洲大片免费 | 毛片内射久久久一区 | 91九色视频无限观看免费 | 午夜免费国产体验区免费的 | 国产成人精品免费视频大全办公室 |