$content = ' 这里是帖子的内容。
这里是帖子的其他内容
$user = $this->session->get('auth'); $baa_id=(int)$_POST['baa_id']; $time = date('Y-m-d H:i:s');
这里是帖子的其他内容
';preg_match_all('#
]*>([^(?:
)]*)
#',$content,$matches);print_r($matches);
Results of the match:
Array
( [0] => Array ( 这里是帖子的内容。
) [1] => Array ( [0] => 这里是帖子的内容。 ))
Why can't the content of other tags such as img span between p tags be matched?
Reply content:
$content = ' 这里是帖子的内容。
这里是帖子的其他内容
$user = $this->session->get('auth'); $baa_id=(int)$_POST['baa_id']; $time = date('Y-m-d H:i:s');
这里是帖子的其他内容
';preg_match_all('#
]*>([^(?:
)]*)
#',$content,$matches);print_r($matches);
Results of the match:
Array
( [0] => Array ( 这里是帖子的内容。
) [1] => Array ( [0] => 这里是帖子的内容。 ))
Why can't the content of other tags such as img span between p tags be matched?
has been updated,preg_match_all('# ]*)>([\s\S]*?)
#',$content,$matches);
This is the complete notation, your problem is that you mistakenly think
[^(?: )]
The representative is in addition to
<>< code=""> >或者
标签以外的匹配。实际上 [^(?: )]
等同于 [^?: ]
这样看就明白了吧
不用正则,xpath
搞定
<>