/* old attempt while(sizeof($snip_array)>1){ //$tempTest = "{hello test {test|testing|{ilike to test|lots}}|testing1234}{testing again}"; //$pattern = '/({(?:[^{}]+(?:"[^"]*"|\'[^\']*\')?)+})/'; $snip_array = preg_split($pattern, trim ($temp), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); print_r($snip_array); $section = $snip_array[1]; print "section: ".$section; // evaluate array[1] always for random & strip { and } //$evaluate = strip_selected_tags($section,$tags); $evaluate = str_replace("{", "", $section); $evaluate = str_replace("}", "", $evaluate); print "evaluate: ".$evaluate; // explode by | $explode = explode("|", $evaluate); print "explode "; print_r($explode); // count new array size $arraySize = sizeof($explode); // pick a random number between 1 and array size $randomNumber = rand(1,$arraySize); print "randomnumber: ".$randomNumber; $newsection = $explode[$randomNumber - 1]; print "newsection: ".$newsection; // replace $section in $temp with $newsection $temp = str_replace($section, $newsection, $temp); print "article # ".$count."

"; // $string =~ m/\s*rem/i; #true if the first printable text is rem or REM - use this for detecting rand, db, etc } //************************** // run one more time if { still exist //$pattern = '/({(?:[^{}]+(?:"[^"]*"|\'[^\']*\')?)+})/'; $snip_array = preg_split($pattern, trim ($temp), -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); print_r($snip_array); $section = $snip_array[0]; print "section: ".$section; // evaluate array[1] always for random & strip { and } //$evaluate = strip_selected_tags($section,$tags); $evaluate = str_replace("{", "", $section); $evaluate = str_replace("}", "", $evaluate); print "evaluate: ".$evaluate; // explode by | $explode = explode("|", $evaluate); print "explode "; print_r($explode); // count new array size $arraySize = sizeof($explode); // pick a random number between 1 and array size $randomNumber = rand(1,$arraySize); print "randomnumber: ".$randomNumber; $newsection = $explode[$randomNumber - 1]; print "newsection: ".$newsection; // replace $section in $temp with $newsection $temp = str_replace($section, $newsection, $temp); print "article # ".$count."

"; // $string =~ m/\s*rem/i; #true if the first printable text is rem or REM - use this for detecting rand, db, etc //************************** */