title: python 3 regex string matching ignore whitespace and string.punctuation
body: <p>I am new to regex and would like to know how to pattern match two strings. The use case would be something like finding a certain phrase in some text. I'm using python 3.7 if that makes a difference.</p>
  
  <pre><code>phrase = "some phrase" #the phrase I'm searching for
  </code></pre>
  
  <p>Possible matches:</p>
  
  <pre><code>text = "some#@$#phrase"
              ^^^^ #non-alphanumeric can be treated like a single space
  text = "some   phrase"
  text = "!!!some!!! phrase!!!"
  </code></pre>
  
  <p>These are not matches:</p>
  
  <pre><code>text = "some phrases"
                     ^ #the 's' on the end makes it false
  text = "ssome phrase"
  text = "some other phrase"
  </code></pre>
  
  <p>I have tried using something like:</p>
  
  <pre><code>re.search(r'\b'+phrase+'\b', text)
  </code></pre>
  
  <p>I would very much appreciate an explanation of why the regex works if you provide a valid solution.</p>