且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

用于在 HTML 中查找类名的正则表达式

更新时间:2021-10-21 22:23:24

这样的事情怎么样:

grep -Erno 'class[ 	]*=[ 	]*"[^"]+"' *

这也将允许更多的空白,并应该给你类似的输出:

That will also allow for more whitespace and should give you output similar to:

1:class="foo bar baz"
3:class = "haha"

要查看使用的所有类,您可以将上面的输出通过管道传输到以下内容中:

To see all classes used, you can pipe output from the above into the following:

cut -f2 -d'"' | xargs | sort | uniq