cleanup KEYS regexp building