Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/18.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
递归公式中的PHP正则表达式_Php_Regex - Fatal编程技术网

递归公式中的PHP正则表达式

递归公式中的PHP正则表达式,php,regex,Php,Regex,我有一个个人的表达: 较大(5.26;7;较小(3.00;6;较大(7;8)) 我想要一个regex函数,它将返回包含带分隔符的括号的内容,例如,将“GREATER”作为表达式传递,regex将返回带分隔符的数组 [0] => 5.26; 7 [1] => 7; 8 我使用的是这个正则表达式preg\u match\u all(“/\((([^()]*(?R))*)\)/”,$valor,$matches)但它不能正确返回我 有人对这个正则表达式有什么看法吗?我建议使用正则表达式/

我有一个个人的表达:

较大(5.26;7;较小(3.00;6;较大(7;8))

我想要一个regex函数,它将返回包含带分隔符的括号的内容,例如,将“GREATER”作为表达式传递,regex将返回带分隔符的数组

[0] => 5.26; 7
[1] => 7; 8
我使用的是这个正则表达式
preg\u match\u all(“/\((([^()]*(?R))*)\)/”,$valor,$matches)但它不能正确返回我


有人对这个正则表达式有什么看法吗?

我建议使用正则表达式
/(?为什么需要递归?只需执行类似
更大\s*\(
添加更多。
全局标志(g)允许它以递归方式工作。
不,不是正则表达式意义上的递归。已修复,正如我所看到的,“多次应用”和“递归”略有不同。
array(3
    0 => array(2
        0 => 5.26; 7
        1 => 7; 8
    )
    1 => array(2
        0 => 5.26
        1 => 7
    )
    2 => array(2
        0 => 7
        1 => 8
    )
)