Home > Backend Development > PHP Tutorial > 求个正则表达式

求个正则表达式

WBOY
Release: 2016-06-06 20:24:57
Original
1213 people have browsed it

[quote]3333[/quote]
匹配quote,然后把之间的内容都提取出来
用php~

回复内容:

[quote]3333[/quote]
匹配quote,然后把之间的内容都提取出来
用php~

只要quote中间部分的话

<code class="php">$matches = [];
$re = "/\\[quote\\](\\S*?)\\[\\/quote\\]/"; 
$str = "[quote]3333[/quote]\n"; 
 
preg_match($re, $str, $matches);

print_r($matches);</code>
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