improve conditional folding logic in regen/regcharclass.pl