Php preg_匹配为3的正则表达式出错 Puesto: 普埃斯托卡贝塞拉市政酒店

Php preg_匹配为3的正则表达式出错 Puesto: 普埃斯托卡贝塞拉市政酒店,php,Php,我想这个表达式是正则的 preg_match(“%Puesto:(.*)%si”,$data,$Puesto) 但它不起作用您可能需要: <td><strong>Puesto:</strong></td> <td>PUESTO CABECERA MUNICIPAL

我想这个表达式是正则的

preg_match(“%Puesto:(.*)%si”,$data,$Puesto)
但它不起作用

您可能需要:

<td><strong>Puesto:</strong></td>
<td>PUESTO CABECERA MUNICIPAL                                                                                               </td>
$ok=preg_match('%Puesto:+?(.+?)%si',$data,$Puesto);

不要忘记使用
将表达式转换为非贪婪表达式

您想要什么输出?未定义的偏移量:echo$puesto[1]中的1;你需要编辑你的问题,明确你想要什么。目前还不清楚。您的示例中没有结束符
,因此不匹配。另外,您不应该使用正则表达式解析HTML。编辑:哦,等等,这只是汽油的出路。还是不要做!很好,谢谢,我的问题的资格是-3分,这似乎不公平,有问题没有兴趣,没有资格不好
$ok = preg_match('%<strong>Puesto:</strong>.+?<td>(.+?)</td>%si', $data, $puesto);