I want to match the string:
test.test ? type == one:prop two:prop
with an regex to get following result:
0 => test.test, 1 => type, 2 => ==, 3 => [[ 0 => one, 1 => prop], [ 0 => two, 1 => prop], ...]
Currently I get only the last match as result with preg_match in PHP 7.3 instead of all matches of the repeating group with the following regex:
([\.a-z]+)\s\?\s([a-z]+)\s(==|!=)\s?(([a-z]+):([\.a-z]+)\s?)+
Check out the tester: https://regex101.com/r/uvATDW/1
How do I have to adapt my regex to achieve the desired result?
I need this regex as part of an retrieving syntax:
Consider the array
[ test => [ test => [ type => one, prop => value1, proptwo => value2]]]
With the regex result of test.test ? type == one:prop two:proptwo
I get the array path test.test.prop
depended on the value of type
. With this path I can retrieve the value1
.