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

replace()
The replace() method retur " /> 九九精品国产亚洲A片无码,51国产午夜精品免费视频,97国产人妻精品无码AV在线

天天躁日日躁狠狠躁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方法說明,轉載需保留來源!

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

主站蜘蛛池模板: 女朋友的妈妈在线观看 | 国产成人小视频在线观看 | 美女胸被男子强捏视频 | 亚洲精品嫩草AV在线观看 | 97午夜伦伦电影理论片 | 成年人在线免费观看视频网站 | 国产av免费观看日本 | 大胸美女被cao哭 | 四虎永久精品视频在线 | 99久久香蕉| qvod 在线电影 | 神电影院午夜dy888我不卡 | 26uuu老色哥| 最近中文字幕在线中文视频 | 亚洲haose在线观看 | 亚洲国产精品一区二区三区在线观看 | 亚洲AV精品乱码专区 | 国产精品欧美久久久久天天影视 | 特级aa 毛片免费观看 | 一本道高清不卡v免费费 | 久久无码AV亚洲精品色午夜麻豆 | 国产高清视频在线播放www色 | 亚洲综合视频 | 99精品在线免费 | 大胸女晃奶动态图 | 暖暖日本 在线 高清 | 四库影院永久国产精品 | 国产日韩欧美综合久久 | 天天澡夜夜澡人人澡 | 久久www免费人成高清 | 亚洲精品自在在线观看 | 在线 无码 中文 强 乱 | 13小箩利洗澡无码视频APP | 免费A级毛片无码无遮挡内射 | 免费一区在线观看 | 色婷婷综合激情中文在线 | 涩涩免费视频软件 | 乌克兰xxxxx 乌克兰18性hd | 97国产视频 | 美女伸开两腿让我爽 | 国产睡熟迷奷系列网站 |