Home > Backend Development > PHP Tutorial > 求一正则表达式,婚配一个限定的id

求一正则表达式,婚配一个限定的id

WBOY
Release: 2016-06-13 10:59:28
Original
872 people have browsed it

求一正则表达式,匹配一个限定的id

  匹配这个id!
------最佳解决方案--------------------
$s='你的串';
preg_match('/
]*>(.*?)/s',$s,$m);
echo $m[1]; 
------其他解决方案--------------------
/ id="([^"]*)"/
------其他解决方案--------------------
引用:
/ id="([^"]*)"/
  匹配forum_list这个固定ID
------其他解决方案--------------------
引用:
/ id="([^"]*)"/
匹配forum_list这个固定ID 以及下面的所有内容!
------其他解决方案--------------------
那个id看上去像discuz的
------其他解决方案--------------------
如果是匹配大堆html内容,最好把内容装载进dom,用dom的方式处理dom
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