<human>:  Python Regex Get String Between Two Substrings
<bot>: Here is some code to get a string `randomkey123xyz987` between two substrings in a string `api('randomkey123xyz987', 'key', 'text')` using regex

re.findall("api\\('(.*?)'", "api('randomkey123xyz987', 'key', 'text')")

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.