title: Regex search to extract float from string. Python
body: <pre><code>import re
  
  sequence = 'i have -0.03 dollars in my hand'
  
  m = re.search('(have )(-\w[.]+)( dollars\w+)',sequence)
  
  print m.group(0)
  print m.group(1)
  print m.group(2)
  </code></pre>
  
  <p>Looking for a way to extract text between two occurrences.  In this case, the format is 'i have ' followed by - floats and then followed by ' dollars\w+'</p>
  
  <p>How  do i use re.search to extract this float ? 
  Why don't the groups work this way ? I know there's something I can tweak to get it to work with these groups.  any help would be greatly appreciated</p>
  
  <p>I thought I could use groups with paranthesis but  i got an eror</p>