Hi,
i've been fiddling a bit and am coming close, however I just miss the finishing touch. Here's the regex and result that I have sofar. As you can see it splits almost correctly, but I'm missing the first character of test1, test2 and test3. The rest is OK. Hope some can show me the finishing touch and i'm happy as a little boy..
I think I've got it.
<code>
preg_match_all('#[^\.](.*?)([\(](.*?)([$\)]))#i',$test,$options,PREG_SET_ORDER);
Result:
Array (
[0] => Array ( [0] => test1(2,3,4) [1] => est1 [2] => (2,3,4) [3] => 2,3,4 [4] => ) )
[1] => Array ( [0] => test2(12333) [1] => est2 [2] => (12333) [3] => 12333 [4] => ) )
[2] => Array ( [0] => test3(8) [1] => est3 [2] => (8) [3] => 8 [4] => ) )
)
Final code which is my opionion correct:
$test = 'test1(2,3,4).test2(12333).test3(8)';
preg_match_all('#([^\.].*?(?<!\.))([\(](.*?)([$\)]))#i',$test,$options,PREG_SET_ORDER);
print_r($options);
Result:
Array (
[0] => Array ( [0] => test1(2,3,4) [1] => test1 [2] => (2,3,4) [3] => 2,3,4 [4] => ) )
[1] => Array ( [0] => test2(12333) [1] => test2 [2] => (12333) [3] => 12333 [4] => ) )
[2] => Array ( [0] => test3(8) [1] => test3 [2] => (8) [3] => 8 [4] => ) ) )
</code>