【发布时间】:2014-01-10 02:04:47
【问题描述】:
已经超过 6 小时试图找到最佳的 PHP 正则表达式来匹配特定的类名 + :before 伪。例如我有这样的css代码
h1 {
font-size: 3em;
line-height: 1.65em;
}
p{line-height: 1.5em; margin: 10px 0;}
.action-admin:before{
content: "";
display: block;
width: 50px;
height: 50px;
}
.action-user:before{
content: "";
display: block;
width: 20px;
height: 20px;
}
footer{
clear: both;
}
所以,我想搜索所有类名与 '.action-{anyotherwords}:before' 匹配的 css 代码并将它们列在 php 变量中(将处理这个到下一个操作)
所以,简单来说 - 我只想从上面的 css 中获取这些代码
.action-admin:before{
content: "";
display: block;
width: 50px;
height: 50px;
}
.action-user:before{
content: "";
display: block;
width: 20px;
height: 20px;
}
【问题讨论】: