Evaluated proc allowed {str chars} {set out ""; map [explode $str] {x { if {[instr $chars $x] != -1} {append out $x} }}; . $out }