应为']'在IE 8文档模式的正则表达式中:IE 8标准

Expected ']' in regular expression for IE 8 document mode :IE 8 standards

本文关键字:IE 正则表达式 标准 文档 应为 模式      更新时间:2023-09-26

使用时

var re =  new RegExp (openTagString + "([''s''S]*?)" + closeTagString + "|''$''{(.*?[^'])''}", "g");

在其他版本的IE中获得类似"Expected ']' in regular expression".[only for IE 8 & document Mode : IE8 standards]的错误,其工作良好

当您将'本身包含在最后一个字符类中时,您需要像这样对其进行四元转义:

var re =  new RegExp (openTagString + "([''s''S]*?)" + closeTagString + "|''$''{(.*?[^''''])''}", "g");