Alexander Schmolck wrote: > Sorry if I missed something obvious, but how do you do this more > intelligently? > > def escape(s): > return re.sub(r'([${}\\])', r'\ \1', s).replace('\\ ', '\\') > re.escape? :) David