title: Extract last string between brackets from a string - python
body: <p>I would like to know the way for extracting the last string between brackets from a long string. So I need a function, <code>extract_last</code>, for example, that let me get an output like that:</p>
  
  <pre><code>&gt;&gt; extract_last('(hello) my (name) is (Luis)')
  &gt;&gt; 'Luis'
  </code></pre>
  
  <p>How can I accomplish that without using a for, I am looking for the smartest way.</p>
  
  <p>The for way that I have implemented works. I have no tested it with all the possibilities, but the simplest things do it well:</p>
  
  <pre><code>def extract_last(string):
      bracket_found = False
      characters = []
      for character in string[::-1]:
          if character == ')':
              bracket_found = True
              continue
          if(character == '(' and bracket_found):
              break;
         if(bracket_found and character != ')'):
              characters.append(character)
      return ''.join(characters[::-1])
  </code></pre>
  
  <p>But this solution has many lines and I know that using regular expressions or something like that, I could accomplish that with a one-or-two-lines solution. </p>