Home > Backend Development > PHP Tutorial > 正则匹配<a>标签内的全部内容

正则匹配<a>标签内的全部内容

WBOY
Release: 2016-06-13 12:01:16
Original
1615 people have browsed it

正则匹配标签内的所有内容
请教需要匹配
标签的所有内容该怎么弄,具体如下


替换不成功,没有替换,请教下是不是写法错了
------解决方案--------------------
很明显空格问题啊
你看a和href之间,还有>前面
把空格换成\s*匹配吧
------解决方案--------------------
$tihuanzi='/
(.*)/';

你的规则串
'/
(.*)/'
      ^这里只有一个空格

而原串中
    ^这里有两个空格

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