1
我有這樣的字符串,我需要把它分解使用reqular表達正則表達式/##if##(.*?)(.*?)##end_if##/s
<?php
$matches = null;
$returnValue = preg_match('/##if##(.*?)(.*?)##end_if##/s', '##if##
First Conditions
##if##
First sub Conditions
##end_if##
##end_if##
##if##
Second Conditions
##end_if##', $matches);
結果是
array (
0 => '##if##
First Conditions
##if##
First sub Conditions
##end_if##',
1 => '',
2 => '
First Conditions
##if##
First sub Conditions
',
)
這是不對的,我需要與##if##
返回內容的開始,並與##end_if##
##,如果## 第一副條件 ## END_IF ##我需要這也是在返回的數組 –