title: Find substring in string but only if whole words?
body: <p>What is an elegant way to look for a string within another string in Python, but only if the substring is within whole words, not part of a word?</p>
  
  <p>Perhaps an example will demonstrate what I mean:</p>
  
  <pre><code>string1 = "ADDLESHAW GODDARD"
  string2 = "ADDLESHAW GODDARD LLP"
  assert string_found(string1, string2)  # this is True
  string1 = "ADVANCE"
  string2 = "ADVANCED BUSINESS EQUIPMENT LTD"
  assert not string_found(string1, string2)  # this should be False
  </code></pre>
  
  <p>How can I best write a function called string_found that will do what I need? I thought perhaps I could fudge it with something like this:</p>
  
  <pre><code>def string_found(string1, string2):
     if string2.find(string1 + " "):
        return True
     return False
  </code></pre>
  
  <p>But that doesn't feel very elegant, and also wouldn't match string1 if it was at the end of string2. Maybe I need a regex? <em>(argh regex fear)</em></p>