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

replace()
The replace() method retur " /> 国产成人自拍视频在线观看,swag合集120部,黄色精品视频

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

JavaScript 中的replace方法說明

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

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技術JavaScript 中的replace方法說明,轉載需保留來源!

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

主站蜘蛛池模板: 艳鉧动漫1~6全集观看在线 | 国外色幼网 | 久啪久久全部视频在线 | 色99久久久久高潮综合影院 | 成片在线看一区二区草莓 | 精品伊人久久 | 欧美极限扩肛 | 18av 在线| 最近的中文字幕免费完整 | 日本午夜精品久久久无码 | 调教女M屁股撅虐调教 | 大岛优香久久中文字幕 | 亚洲成人欧美 | 胸大的姑娘中文字幕视频 | 黄色jjzz | 日本视频一区二区免费观看 | 在线综合 亚洲 欧美 | 亚洲a视频在线观看 | 男女牲交大战免费播放 | 性生生活大片又黄又 | 欧美另类与牲交ZOZOZO | 国产产乱码一二三区别免费 | 亚洲免费一区 | 午夜免费国产体验区免费的 | 少妇无码吹潮久久精品AV网站 | 99re久久精品在线播放 | 亚洲性无码AV久久成人 | 99精品免费久久久久久久久蜜桃 | 国产成人精品久久一区二区三区 | 某上海少妇3P黑人完整版BD | 小夫妻天天恶战 | 怡春院欧美一区二区三区免费 | 99精品视频一区在线视频免费观看 | 国内卡一卡二卡三免费网站 | 真实国产精品视频国产网 | 日韩视频中文字幕精品偷拍 | 午夜伦伦电影理论片大片 | 皮皮在线精品亚洲 | 亚洲精品乱码久久久久久中文字幕 | 天天日免费观看视频一1 | 伊人成色综合人网 |