title: Regex Python~Get Everything In Between, If the word is not enclosed by single quotes
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/10642346/replacing-unquoted-words-only-in-python">Replacing unquoted words only in Python</a>  </p>
  </blockquote>
  
  
  
  <p>This is what I have right now</p>
  
  <pre><code>found = re.match( r"hello[(](.*)[)]", word, re.M|re.I)
  </code></pre>
  
  <p>It will find:</p>
  
  <pre><code>Hello(here)  and give you "here"
  </code></pre>
  
  <p>I would like it to be able to do the following:</p>
  
  <pre><code>Hello  (Hi)     
  </code></pre>
  
  <p>return the value even if there is whitespace on either side (but only white space, not other characters), So this would return "Hi"</p>
  
  <pre><code>'dfsfds Hello (Hi) fdfd' Hello (Yes)     
  </code></pre>
  
  <p>this would return "Yes" because the first part is enclosed by single quotes, so we don't use that (the whitespace rule still applies here if possible)</p>
  
  <p>EDIT:</p>
  
  <pre><code> Hello  ('Hi')  would return 'Hi'   
  </code></pre>