Home > Backend Development > PHP Tutorial > 求一正则表达式的写法解决思路

求一正则表达式的写法解决思路

WBOY
Release: 2016-06-13 10:51:07
Original
794 people have browsed it

求一正则表达式的写法
有这么一种情况,每行字符是这种格式的:
{内容1}{内容2}。。。
内容被包含在{}中,每行有不等的{}。
请给个程序,能把这些内容取出,放入一个数组中

------解决方案--------------------

探讨

$str="{123}{456}{789}{012}{245}{754}";
$pre="/{.*[^}]}/iUs";
preg_match_all($pre,$str,$content);
print_r($content);
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