Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

我有更好的正则: 是否html标签 #21

Closed
xinglie opened this issue Aug 5, 2019 · 1 comment
Closed

我有更好的正则: 是否html标签 #21

xinglie opened this issue Aug 5, 2019 · 1 comment

Comments

@xinglie
Copy link

xinglie commented Aug 5, 2019

我不知道你这个本意是严格还是宽松验证,这个不过的例子非常多,比如

<div id="abc"></div>
<br>
<div>
内容换行了
</div>

你可以参考下html-parser https://github.com/blowsie/Pure-JavaScript-HTML5-Parser/blob/master/htmlparser.js#L85

startOpen就是验证开始html标签的,你或许需要整理下
不过上面这个也是宽松了一些,更完整的可以看这个html-parserhttps://github.com/thx/magix-composer/blob/master/plugins/html-parser.js#L19

@any86
Copy link
Owner

any86 commented Aug 5, 2019

起初还真没想过他是宽松还是严谨的, 这个是以前自己练习用的, 既然原来这么复杂, 那我标注上"宽松"

@any86 any86 closed this as completed Aug 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants