title: regex OR/ALTERNATIVE help
body: <p>Need a little help with a regex</p>
  
  <p>I'm trying to match a string that falls at the begging or end of a larger string,  or follows or is followed by whitepace. Or any combination of the two.</p>
  
  <p>(Basically I want to find a particular string, but only match it if it is not part of another word or phrase.  IE  if the string I was searching for was "are" I wouldn't want to match "are" in the word "area",  hence either beginning or end of searched string, or follows or is followed by whitespace.)</p>
  
  <p>Here is what I have now:</p>
  
  <pre><code>re.compile('^(%(string)s)$|\s(%(string)s)$|^(%(string)s)\s|\s(%(string)s)\s' % {'string': my_string})
  </code></pre>
  
  <p>Is there a less verbose way of writing this using two |'s .  One at the beging for start or whitespace, and one at the end for end or whitespace?</p>
  
  <p>Write now I am writing out every permutation of beginning options * end option and figure its less efficient.</p>