($re=$_)=~s/((\Q$q1\E)|(\Q$q2\E)|.)/${['(','']}[!$2]\Q$1\E${[')','']}[!$3]/gs; @$ = (eval{/$re/},$@); print join"\n",@$ unless $$[-1]=~/unmatched/;