js中replace的正则替换

时间:2022-02-05 19:11:00

temp:

video":"\t<ul class=\"g-list tabview-cont on\">\t\r\n\t\t<li class=\"g-pic cover\"><div class=\"slide-content\"><div class=\"slide-item first\"><a href=\"http://v.360.cn/news/index.html?src=hao360zc1&date=2014012603\"><img src=\"http://p8.qhimg.com/t019454e177d430322c.jpg\"><em class=\"txt icon-play\">&lt;爸爸去哪儿&gt;首映萌娃失控</em><span class=\"txt-bg\"></span><span class=\"mask\"></span></a></div><div class=\"slide-item\"><a href=\"http://v.360.cn/news/index.html?src=hao360zc1&date=2014012602\"><img src=\"http://p9.qhimg.com/t015b48db5c407c3610.jpg\"><em class=\"txt icon-play\">马尔代夫现梦幻“荧光海滩”奇景</em><span class=\"txt-bg\"></span><span class=\"mask\"></span></a></div><div class=\"slide-item\"><a href=\"http://v.360.cn/news/index.html?src=hao360zc1&date=2014012606\"><img src=\"http://p8.qhimg.com/t01fbcccc42240c8de2.jpg\"><em class=\"txt icon-play\">张馨予晒母女合照 神似姐妹</em><span class=\"txt-bg\"></span><span class=\"mask\"></span></a></div><div class=\"slide-item\"><a href=\"http://v.360.cn/news/index.html?src=hao360zc1\"><img src=\"http://p9.qhimg.com/t01af89d30596c83020.jpg\"><em class=\"txt icon-play\">全面的时事新闻 知悉天下事</em><span class=\"txt-bg\"></span><span class=\"mask\"></span></a></div></div><ul class=\"slide-nav\"><li class=\"selected\">0</li><li class=\"\">1</li><li class=\"\">2</li><li class=\"\">3</li></ul><a href=\"\" onclick=\"return false;\" class=\"slide-btn slide-pageup\" style=\"display: none;\"><span class=\"bg\"></span><em class=\"arrow\">&lt;</em></a><a href=\"\" onclick=\"return false;\" class=\"slide-btn slide-pagedown\" style=\"display: none;\"><span class=\"bg\"></span><em class=\"arrow\">&gt;</em></a></li><li ><ins class=\"icon play\"></ins><a href=\"http://map.m.360.cn/t/ebwZ\" class=\" noactive \">揭秘艺校女生五大财色潜规则</a></li><li ><ins class=\"icon play\"></ins><a href=\"http://map.m.360.cn/t/ebvZ\" class=\" noactive \">男子被偷因女贼太美求交往</a></li><li ><ins class=\"icon play\"></ins><a href=\"http://map.m.360.cn/t/emvZ\" class=\" noactive \">盘点历届央视春晚穿帮瞬间</a></li><li ><ins class=\"icon play\"></ins><a href=\"http://v.360.cn/news/index.html?src=hao360zc1&date=2014012604\" class=\" noactive \">世界第一巨胸挑战吉尼斯记录</a></li>\t</ul>\t\r\n\t<ul class=\"g-list tabview-cont\">\t\r\n\t\t<li class=\"g-pic cover\"><div class=\"slide-content\"><div class=\"slide-item first\"><a href=\"http://v.360.cn/tv/PbZsaKOrSm0uNX.html?src=hao360zc2\"><img src=\"http://p8.qhimg.com/t01d1267f35383d4486.jpg\"><em class=\"txt icon-play\">《新天龙八部》钟汉良卖萌</em><span class=\"txt-bg\"></span><span class=\"mask\"></span></a></div><div class=\"slide-item\"><a href=\"http://v.360.cn/tv/QbNqba3qRz8sOH.html?src=hao360zc2\"><img src=\"http://p9.qhimg.com/t0153603087c2ce9d83.jpg\"><em class=\"txt icon-play\">《喋血孤岛》百变女特工</em><span class=\"txt-bg\"></span><span class=\"mask\"></span></a></div><div class=\"slide-item\"><a href=\"http://v.360.cn/dianshi/hanju.html?src=hao360zc2\"><img src=\"http://p8.qhimg.com/t013d65140264b3b36a.jpg\"><em class=\"txt icon-play\">《来自星星的你》第一初恋</em><span class=\"txt-bg\"></span><span class=\"mask\"></span></a></div><div class=\"slide-item\"><a href=\"http://v.360.cn/dianshi/index.html?src=hao360zc2\"><img src=\"http://p9.qhimg.com/t017ba1bc5290bf1dc5.jpg\"><em class=\"txt icon-play\">电视台最新热播剧 同步跟播</em><span class=\"txt-bg\"></span><span class=\"mask\"></span></a></div></div><ul class=\"slide-nav\"><li class=\"selected\">0</li><li class=\"\">1</li><li class=\"\">2</li><li class=\"\">3</li></ul><a href=\"\" onclick=\"return false;\" class=\"slide-btn slide-pageup\" style=\"display: none;\"><span class=\"bg\"></span><em class=\"arrow\">&lt;</em></a><a href=\"\" onclick=\"return false;\" class=\"slide-btn slide-pagedown\" style=\"display: none;\"><span class=\"bg\"></span><em class=\"arrow\">&gt;</em></a></li><li ><ins class=\"icon play\"></ins><a href=\"http://v.360.cn/tv/PbJsb3KsRzXuOX.html?src=hao360zc2\" class=\" noactive \">《男媒婆》潘长江爆笑开婚介</a></li><li ><ins class=\"icon play\"></ins><a href=\"http://v.360.cn/tv/PLZsbaGoSGXlM3.html?src=hao360zc2\" class=\" noactive \">《战火兵魂》纯爷们基情之恋</a></li><li ><ins class=\"icon play\"></ins><a href=\"http://v.360.cn/tv/Q4Vqaa7sRGTrMX.html?src=hao360zc2\" class=\" noactive \">《与狼共舞2》特种兵剿匪记</a></li><li ><ins class=\"icon play\"></ins><a href=\"http://v.360.cn/tv/Q4lwaKKpSGDmNX.html?src=hao360zc2\" class=\" noactive \">《完美新娘》</a><a href=\"http://v.360.cn/tv/RbFpbKSrTzTqNH.html?src=hao360zc2\" class=\" noactive \">《一代枭雄》</a></li>\t</ul>\t\r\n\t<ul class=\"g-list tabview-cont\">\t\r\n\t\t<li class=\"g-pic cover\"><div class=\"slide-content\"><div class=\"slide-item first\"><a href=\"http://v.360.cn/m/gqfiZUb8QXf3UR.html?src=hao360zc3\"><img src=\"http://p8.qhimg.com/t01b2037fbbf931e476.jpg\"><em class=\"txt icon-play\">《全民目击》还原李某某事件</em><span class=\"txt-bg\"></span><span class=\"mask\"></span></a></div><div class=\"slide-item\"><a href=\"http://v.360.cn/m/gKPjZUXAQnL6TB.html?src=hao360zc3\"><img src=\"http://p9.qhimg.com/t0114c6fd1d4b464c20.jpg\"><em class=\"txt icon-play\">《四大名捕2》柳岩波涛汹涌</em><span class=\"txt-bg\"></span><span class=\"mask\"></span></a></div><div class=\"slide-item\"><a href=\"http://v.360.cn/m/hKfrZEnARXb3UR.html?src=hao360zc3\"><img src=\"http://p8.qhimg.com/t01384c78d1845872e2.jpg\"><em class=\"txt icon-play\">《少女》和爸爸宾馆相遇</em><span class=\"txt-bg\"></span><span class=\"mask\"></span></a></div><div class=\"slide-item\"><a href=\"http://v.360.cn/dianying/index.html?src=hao360zc3\"><img src=\"http://p9.qhimg.com/t017d8f8eebab0e2a21.jpg\"><em class=\"txt icon-play\">最新最热的院线热映大片</em><span class=\"txt-bg\"></span><span class=\"mask\"></span></a></div></div><ul class=\"slide-nav\"><li class=\"selected\">0</li><li class=\"\">1</li><li class=\"\">2</li><li class=\"\">3</li></ul><a href=\"\" onclick=\"return false;\" class=\"slide-btn slide-pageup\" style=\"display: none;\"><span class=\"bg\"></span><em class=\"arrow\">&lt;</em></a><a href=\"\" onclick=\"return false;\" class=\"slide-btn slide-pagedown\" style=\"display: none;\"><span class=\"bg\"></span><em class=\"arrow\">&gt;</em></a></li><li ><ins class=\"icon play\"></ins><a href=\"http://v.360.cn/m/fqPnakD8SHX2UB.html?src=hao360zc3\" class=\" noactive \">《风暴》土豪式的疯狂炸翻天</a></li><li ><ins class=\"icon play\"></ins><a href=\"http://v.360.cn/m/gKXnYkLAQXr5Sh.html?src=hao360zc3\" class=\" noactive \">《半熟少女》16款萌妹随你挑</a></li><li ><ins class=\"icon play\"></ins><a href=\"http://v.360.cn/m/gqTlZkPARnH3SR.html?src=hao360zc3\" class=\" noactive \">《神偷奶爸2特辑》全程卖萌</a></li><li ><ins class=\"icon play\"></ins><a href=\"http://v.360.cn/m/gKjjZknAQXf0TB.html?src=hao360zc3\" class=\" noactive \">《深》</a><a href=\"http://v.360.cn/m/fajlZkH8RXL1UB.html?src=hao360zc3\" class=\" noactive \">《铁血娇娃》</a></li>\t</ul>\t\r\n\t<ul class=\"g-list tabview-cont\">\t\r\n\t\t<li class=\"g-pic cover\"><div class=\"slide-content\"><div class=\"slide-item first\"><a href=\"http://v.360.cn/yule/index.html?src=hao360zc4&date=201401262\"><img src=\"http://p8.qhimg.com/t017755193cd9f0a3de.jpg\"><em class=\"txt icon-play\">21岁学生当选日本小姐冠军</em><span class=\"txt-bg\"></span><span class=\"mask\"></span></a></div><div class=\"slide-item\"><a href=\"http://v.360.cn/yule/index.html?src=hao360zc4&date=201401263\"><img src=\"http://p9.qhimg.com/t01d71367c6e2fc9e0e.jpg\"><em class=\"txt icon-play\">Makiyo接《夜蒲》博翻身</em><span class=\"txt-bg\"></span><span class=\"mask\"></span></a></div><div class=\"slide-item\"><a href=\"http://v.360.cn/yule/index.html?src=hao360zc4&date=201401261\"><img src=\"http://p8.qhimg.com/t017508ca1f697413dd.jpg\"><em class=\"txt icon-play\">冯氏春晚 看点槽点任您选</em><span class=\"txt-bg\"></span><span class=\"mask\"></span></a></div><div class=\"slide-item\"><a href=\"http://v.360.cn/yule/index.html?src=hao360zc4\"><img src=\"http://p9.qhimg.com/t01893d52e0b76c89b6.jpg\"><em class=\"txt icon-play\">新鲜热辣的明星资讯与爆料</em><span class=\"txt-bg\"></span><span class=\"mask\"></span></a></div></div><ul class=\"slide-nav\"><li class=\"selected\">0</li><li class=\"\">1</li><li class=\"\">2</li><li class=\"\">3</li></ul><a href=\"\" onclick=\"return false;\" class=\"slide-btn slide-pageup\" style=\"display: none;\"><span class=\"bg\"></span><em class=\"arrow\">&lt;</em></a><a href=\"\" onclick=\"return false;\" class=\"slide-btn slide-pagedown\" style=\"display: none;\"><span class=\"bg\"></span><em class=\"arrow\">&gt;</em></a></li><li ><ins class=\"icon play\"></ins><a href=\"http://map.m.360.cn/t/e6tZ\" class=\" noactive \">众女神助力电玩展现场似选美</a></li><li ><ins class=\"icon play\"></ins><a href=\"http://map.m.360.cn/t/eExZ\" class=\" noactive \">比伯疑遭陷害 醉驾或被推翻</a></li><li ><ins class=\"icon play\"></ins><a href=\"http://map.m.360.cn/t/eQyZ\" class=\" noactive \">杨幂连跑带跳短裙露孕妇肚贴</a></li><li ><ins class=\"icon play\"></ins><a href=\"http://map.m.360.cn/t/eiAZ\" class=\" noactive \">黄晓明自曝已有浪漫求婚计划</a></li>\t</ul>\t\r\n

需求:将数据中的\"  \t  \r  \n 都替换掉.

var r1 = /\\t/g;
var r2 = /\\r/g;
var r3 = /\\n/g;
var r4 = /\\"/g;
temp = temp.replace(r1, "").replace(r2, "").replace(r3, "").replace(r4, "\"");