且构网

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

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

更新时间:2023-02-21 12:17:12

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

这也允许有更多的空格,并且应该给你类似的输出:

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