首页 > 请教下如何使用正则提取出<p>标签中的数字

请教下如何使用正则提取出<p>标签中的数字

网站代码如下 ,请教习如何在file_get_contentes 后通过正则匹配或者其他方法 获取出1500,0,0,0,这个四个数字,感谢 自己尝试了一下 无果,还望大神相助。

以下是自己尝试 却没有成功

<?php
header("Content-type:text/html;charset=utf-8");
$xmldata = file_get_contents("http://119977.vhost155.cloudvhost.net/data.php")
$preg = '#<p>.[0-9][人]{0,}.</p>#isU';
preg_match_all($preg,$xmldata,$new_arr);
print_r($new_arr);
?>

<?php

$preg = '/<p>.*?(\d+).*?<\/p>/';

$str = '<p>asdff23sdfas</p>';

preg_match($preg,$str,$result);

echo "<pre>";
print_r($result);

:([0-9]+)[个|人]

【热门文章】
【热门文章】