[英]JS regex code doesn't work with firefox, but works on chrome and IE
I'm having here a problem... (also not really a good js programmer, more a html/css person). 我在这里遇到问题...(也不是一个真正的js程序员,更不是一个html / css人)。 This code worked flawless before, but now it stopped working under firefox. 这段代码以前运行得很完美,但是现在在Firefox下停止了工作。 I have no clue why though... 我不知道为什么...
Its this line: 其这一行:
.replace(/((<li>(.*?)<\/li>){28})/g,'<ul>$1</ul>')
When I remove {28} it starts working again, but of course the script stops wrapping the li's in groups. 当我删除{28}时,它再次开始工作,但是脚本当然停止将li的分组包装。
Firefox only tells me this: an error occurred while executing regular expression Firefox仅告诉我这一点:执行正则表达式时发生错误
Maybe someone here had the same problem or an idea... 也许这里有人遇到相同的问题或想法...
Thanks! 谢谢!
The below regex would store the texts from <li>
to </li>
into a group, 下面的正则表达式会将<li>
到</li>
的文本存储到一个组中,
.replace(/(?:(<li>(.*?)<\/li>){28})/g,'<ul>$1</ul>')
Or if you want the text between <li>
tags, then use the below regex, 或者,如果您想要<li>
标记之间的文本,请使用以下正则表达式,
.replace(/(?:(?:<li>(.*?)<\/li>){28})/g,'<ul>$1</ul>')
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.