Home > Backend Development > PHP Tutorial > 一个正则有关问题求解

一个正则有关问题求解

WBOY
Release: 2016-06-13 11:56:13
Original
1082 people have browsed it

一个正则问题求解
我的正则是这样的"",我想取页面中文字中的文字却又不想取一个正则有关问题求解 >这种格式的,我的正则该如何写,求大神指点。
------解决方案--------------------

preg_match('#<a>(.+?)</a>#',$s,$m);<br />echo $m[1];
Copy after login

------解决方案--------------------
$str = "<a><img  alt="一个正则有关问题求解" ></img >文字</a>";<br />$sr = strip_tags($str,'<a>');<br />var_dump($sr);
Copy after login

------解决方案--------------------
<br />$test = "<a class='123'>test</a><a href='//m.sbmmt.com/ss'><img  src='aa.jpg'/ alt="一个正则有关问题求解" ></a><a>123</a>";<br />$s = "#<a[^>]*>[^<]*<\/a>#";<br />preg_match_all($s,$test,$res);<br />print_r($res);<br />
Copy after login

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