如何匹配所有.mod_1 开头的css?mod.css文件中代码如下:.mod_1
{
border: 1px solid #E8CEAE;
}
.mod_1 .hd
{
background: url(mod_1.png) repeat-x 0 0;
height: 25px;
line-height: 25px;
}
.mod_1 .bd
{
padding: 12px;
}
.mod_2 .hd
{
background-image: url(mod_2.png);
height: 25px;
line-height: 25px;
border-right: 1px solid #CBCFD6;
}
.mod_2 .hd H3
{
padding-left: 15px;
}
.....
我想将以.mod_1开头的所有相关css全部匹配出来放到result数组里面去。
<?php
$file="mod.css";
$code=file_get_contents($file);
$regex="/\."."mod_1"."[^\{]*\{[^\{]*\}/s";
preg_match($regex,$code,$result);
print_r($result);
?>
结果只出来
.mod_1
{
border: 1px solid #E8CEAE;
}高手帮忙看看怎么改?