Most CBR systems rely on a fixed library of cases, where each case consists of a set of facts specified in advance. This paper describes techniques for dynamically extracting cases for analogical reasoning from general-purpose knowledge bases, and dynamically expanding them during the course of analogical reasoning. These techniques have several advantages: (1) Knowledge authoring is simplified, since facts can be added without regard to which case(s) they will be used in. (2) Reasoning is more efficient, since task constraints can be used during case extraction to focus on facts likely to be relevant. (3) Larger problems can be tackled, since cases can be dynamically expanded with more details during the matching process itself, rather than starting with completely detailed cases. We describe algorithms for case extraction and case expansion, including how a version of the Structure-Mapping Engine (SME) has been modified to incorporate this new matching technique. The utility of this technique is illustrated by results obtained with two large knowledge bases, created by other groups, and used to answer questions in the DARPA High-Performance Knowledge Base Crisis Management Challenge Problem.