1)How do I parse nested parenteses using Regex. This dooes not work:
$variation="(( ( (?>[()]+) | (?R) ) ))";
preg_match_all("%
\d \s
$variation \s
(?{print "Hello"})
%Sxms",
"6 (in1a (in2) in1b)",
$out, PREG_SET_ORDER);
print_r($out);
2) How to replace the highest level parenteses with other characters ? Example:
"6 (in1a (in2) in1b)"
should be replaced with:
"6 (%in1a (in2) in1b%)"