select('\1');", $source);模板引擎里的..------解决方案-------------------- 匹配出字符串【{..."/> select('\1');", $source);模板引擎里的..------解决方案-------------------- 匹配出字符串【{...">

/{([^}{n]*)}/e 这个正则能婚配出什么

WBOY
Release: 2016-06-13 13:25:25
Original
746 people have browsed it

/{([^\}\{\n]*)}/e 这个正则能匹配出什么?
return preg_replace("/{([^\}\{\n]*)}/e", "\$this->select('\\1');", $source);
模板引擎里的..

------解决方案--------------------
匹配出字符串【{....}】 其中的【...】不包含【{】【}】以及换行
------解决方案--------------------
貌似是取最内层的{}中的内容, 不允许嵌套.
------解决方案--------------------
[^\}\{\n]
表示不包括 }、{、\n

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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!