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

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

WBOY
Release: 2016-06-13 12:45:34
Original
1022 people have browsed it

哎,求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 />
Copy after login


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

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


求高人指点
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template