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

replace()
The replace() method retur " /> 手机在线成人精品视频网 ,亚洲久热无码中文字幕,成人高清网站

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

JavaScript 中的replace方法說明

第一次發(fā)現(xiàn)JavaScript中replace() 方法如果直接用str.replace("-","!") 只會替換第一個(gè)匹配的字符.  
而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)記有誤,請第一時(shí)間聯(lián)系我們修改或刪除,多謝。

主站蜘蛛池模板: 国产成人亚洲精品午夜国产馆 | 秋霞伦理高清视频在线 | 伊人大香人妻在线播放 | 97在线视频免费播放 | 偷拍精品视频一区二区三区 | 亚洲另类欧美综合在线 | 内射人妻骚骚骚 | 男人插女人动态 | 综合激情区视频一区视频二区 | 欧美xxbb| 亚洲欧美色综合影院 | 久久精品亚洲热综合一本奇米 | 日久精品不卡一区二区 | 亚洲一区二区免费看 | 亚州免费一级毛片 | 一二三四免费中文在线1 | 99精品国产电影 | 亚洲国产AV精品一区二区蜜芽 | 内射白嫩少妇超碰 | 97午夜理论片影院在线播放 | 国产亚洲精品久久久久久无码网站 | 婷婷六月激情综合一区 | 日本一卡二卡三卡四卡无卡免费播放 | 豆奶视频在线高清观看 | 色青青草原桃花久久综合 | 欧美极限变态扩张video | 福利社影院 | 又黄又湿免费高清视频 | 亚洲精品免播放器在线观看 | 亚洲精品第一国产综合 | 一个人在线观看视频免费 | 三级黄色片免费观看 | 阴茎插入阴道 | 9420高清完整版在线电影免费观看 | 亚洲VA欧美VA天堂V国产综合 | 阿娇和冠希13分钟在线观看 | a4you销魂gogo人体 | 人妻熟妇乱又伦精品视频中文字幕 | 爆操日本美女 | 亚洲AV久久无码精品九九软件 | 2020年国产精品午夜福利在线观看 |