regexp匹配strickly html注释字符串 [英] Regexp match strickly html comment string
本文介绍了regexp匹配strickly html注释字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图使用regexp从.html文件中删除所有html注释。
我们知道html注释格式是<! - 一些注释 - >
我创建了这样的regexp
I'am trying to use regexp to strip all html comments from .html file.
As we know html comments format are <!-- some comments -->
I've create such regexp
/<! - 。* - > / gs
它的工作原理,但如果文件中有多个注释块,它不会剥离任何一个到另一个块,但所有从第一<! -
code> - >
Fe
It works, but if there is more than one comment block in file, it strips no one to another block, but all from first <!--
to last -->
F.e.
some html tags
<!-- some comments 1 -->
some html tags 2
<!-- some comments 2-->
它整条
<!-- some comments 1 -->
some html tags 2
<!-- some comments 2-->
使用ActionScript语言编写代码。
任何建议都会有帮助。
谢谢!
I'am code with ActionScript language. Any advice would be helpful. Thanks!
推荐答案
使用问号使星号延迟:
/<!--.*?-->/gs
这篇关于regexp匹配strickly html注释字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文