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

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

WBOY
WBOYOriginal
2016-06-13 13:09:23785browse

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

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

探讨

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