有这样一个字符串:
$str = '<div class="info"> <small>时间:</small>2015-12-24 09:47<small>来源:</small>华尔街见闻 <small>作者:</small>member <small>点击:</small> <script src="/plus/count.php?view=yes&aid=467&mid=2" type="text/javascript" language="javascript"></script>145 次 </div>';
匹配 时间: 和来源 之间的吧。。
/d+-\d+-\d+ \d+:\d+/
/d+-\d+-\d+ \d+:\d+/
header('Content-type:text/html;charset=UTF-8');$str = '<div class="info"> <small>时间:</small>2015-12-24 09:47<small>来源:</small>华尔街见闻 <small>作者:</small>member <small>点击:</small> <script src="/plus/count.php?view=yes&aid=467&mid=2" type="text/javascript" language="javascript"></script>145 次 </div>';preg_match_all('/d+-\d+-\d+ \d+:\d+/', $str, $matches);print_r($matches);
不好意思,漏了个 \
preg_match_all('/\d+-\d+-\d+ \d+:\d+/', $str, $matches); print_r($matches);
不好意思,漏了个 \
preg_match_all('/\d+-\d+-\d+ \d+:\d+/', $str, $matches); print_r($matches);