title: Why my regex with r'string' matches but not 'string' using Python?
body: <p>The way regex works in Python is so intensely puzzling that it makes me more furious with each passing second. Here's my problem:</p>
  
  <p>I understand that this gives a result:</p>
  
  <pre><code>re.search(r'\bmi\b', 'grand rapids, mi 49505)
  </code></pre>
  
  <p>while this doesn't:</p>
  
  <pre><code>re.search('\bmi\b', 'grand rapids, mi 49505)
  </code></pre>
  
  <p>And that's okay. I get that much of it. Now, I have a regular expression that's being generated like this:</p>
  
  <pre><code>regex = '|'.join(['\b' + str(state) + '\b' for state in states])
  </code></pre>
  
  <p>If I now do <code>re.search(regex, 'grand rapids, mi 49505')</code>, it fails for the same reason my second <code>search()</code> example fails.</p>
  
  <p>My question: Is there any way to do what I'm trying to do?</p>