title: Python Regex Get String Between Two Substrings
body: <p>First off, I know this may <em>seem</em> like a duplicate question, however, I could find no working solution to my problem.</p>
  
  <p>I have string that looks like the following:</p>
  
  <pre><code>string = "api('randomkey123xyz987', 'key', 'text')"
  </code></pre>
  
  <p>I need to extract <em>randomkey123xyz987</em> which will always be between <em>api('</em> and <em>',</em></p>
  
  <p>I was planning on using Regex for this, however, I seem to be having some trouble.</p>
  
  <p>This is the only progress that I have made:</p>
  
  <pre><code>import re
  string = "api('randomkey123xyz987', 'key', 'text')"
  match = re.findall("\((.*?)\)", string)[0]
  print match
  </code></pre>
  
  <p>The following code returns <em>'randomkey123xyz987', 'key', 'text'</em></p>
  
  <p>I have tried to use <em>[^']</em>, but my guess is that I am not properly inserting it into the re.findall function.</p>
  
  <p>Everything that I am trying is failing.</p>
  
  <hr>
  
  <p>Update: My current workaround is using <em>[2:-4]</em>, but I would still like to avoid using <em>match[2:-4]</em>.</p>