87,991
社区成员
发帖
与我相关
我的任务
分享function test() {
var content = "<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}o\:* 400;}中间省略一万字</style><![endif]-->";
var reg = /<!--([\s\S]+)-->/;
content = content.replace(reg, "$1");
alert(content);
}
var str = "<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}o\:* 400;}中间省略一万字</style><![endif]-->";
// 法1
alert( str.split('<!--[if !mso]>')[1].split('<![endif]-->')[0] );
// 法2
var re = /^<!--\[if !mso\]>(.*?)<!\[endif\]-->$/;
alert( str.match(re)[1] );