title: Using str_extract in R to extract a number before a substring with regex
body: <p>I would like to use str_extract in the stringr package to extract the numbers from strings in the form <code>XX nights etcetc</code>.</p>
  
  <p>I'm currently doing this:</p>
  
  <pre><code>library(stringr)
  
  str_extract("17 nights$5 Days", "(\\d)+ nights")
  </code></pre>
  
  <p>but that returns</p>
  
  <p><code>"17 nights"</code></p>
  
  <p>instead of <code>17</code>.</p>
  
  <p>How can I extract just the number? I thought specifying the extract group with parentheses would work, but it doesn't.</p>