Wildcard use isn’t possible in a table lookup. An alternate solution that I use for this scenario (we’ve just upgraded to a newer Cbord dietary version where allergies have to be built in a ‘dictionary’, and with our users able to free-text in the allergy in the HIS, I do some intervention). I use a switch statement, give the literal matches to their corresponding new values, and in the default section (section reached if no match in the top section) I have a series of regexp so a wildcard search can be used.
lassign $xlateInVals allergy_in
# set up as proc vs. table so that regexp can be used in the default section, if needed
switch $allergy_in {
CHEESE {set xlateOutVals NOCHEESE}
CHICKEN {set xlateOutVals NOCHICKEN}
CHOCOLATE {set xlateOutVals NOCHOC}
EGGS {set xlateOutVals NOEGG}
FISH {set xlateOutVals NOFISH}
MILK {set xlateOutVals NOMILK}
MSG {set xlateOutVals NOMSG}
MUSHROOMS {set xlateOutVals NOMUSH}
NUTS {set xlateOutVals NONUT}
PORK {set xlateOutVals NOPORK}
STRAWBERRIES {set xlateOutVals NOSTRA}
default { if {[regexp — {LACTOSE} $allergy_in]} {set xlateOutVals NOLACT}
if {[regexp — {NUTS} $allergy_in]} {set xlateOutVals NONUT}
if {[regexp — {CARROT} $allergy_in]} {set xlateOutVals NOCARROT}
if {[regexp — {PEPPER} $allergy_in]} {set xlateOutVals NOPEPPER}
if {[regexp — {GREEN BEAN} $allergy_in]} {set xlateOutVals NOGRNBEAN}
}
}