title: Clean method for storing regex strings in python
body: <p>I want to store a series of pre-tested regexes in a config file, and read and apply them at runtime. </p>
  
  <p>However, because they're commonly packed with escape characters, by the time I've loaded them up into memory, and populated them into a dict, they've been escaped to death. </p>
  
  <p>How can I preserve the integrity of my regex definitions, so that they will <code>re.compile</code>? </p>
  
  <p>Alternately, given that many of the post-escape strings end up in a form with <code>\x00</code> characters, how do I convert these back into a form that will be consumed correctly by <code>re.compile</code>?</p>
  
  <p>e.g. I have written in a file, the regex <code>"\btest\b"</code>. If I want to put this into a re.compile, I can force it to do so with <code>re.compile(r"\btest\b")</code>. However, I don't want to write this code by hand, I want to lift it from a file, and process it as a variable (I've got 000's of these to deal with here) .</p>
  
  <p>There doesn't seem to be a way to <code>r</code> a string variable, and so I'm left trying to compile with <code>'\x08test\x08'</code>, which doesn't do what I want it to. </p>
  
  <p>This must be a fairly regular issue - how do others deal with this problem?</p>