Home >Backend Development >PHP Tutorial > 哎,求2个正则合并成一个正则如何写啊多谢

哎,求2个正则合并成一个正则如何写啊多谢

WBOY
WBOYOriginal
2016-06-13 12:45:341031browse

哎,求2个正则合并成一个正则怎么写啊,谢谢

本帖最后由 cluonani 于 2013-05-13 14:40:09 编辑 这是要匹配的内容
<br />
<td class="LightRowHead"><br />
Primary Color:<br />
</td><br />
<td class="LightRow"><br />
Multi-Color<br />
</td><br />
</tr><br />
<tr><br />
<td class="DarkRowHead"><br />
Multi Pack Indicator:<br />
</td><br />
<td class="DarkRow"><br />
No<br />
</td><br />
</tr><br />
<tr><br />
<td class="LightRowHead"><br />
Battery Type:<br />
</td><br />
<td class="LightRow"><br />
Does Not Contain a Battery<br />
</td><br />
</tr><br />


这个个正则,怎么合并成一个啊
<br />
$a = preg_match_all('/LightRowHead.*?>(.*?):.*?LightRow.*?>(.*?)</is', $content, $a);<br />
$a = preg_match_all('/DarkRowHead.*?>(.*?):.*?DarkRow.*?>(.*?)</is', $content, $b);<br />

我这样写不对
<br />
$a = preg_match_all('/[LightRowHead|DarkRowHead].*?>(.*?):.*?[LightRow|DarkRow].*?>(.*?)</is', $content, $c);<br />


求高人指点
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn