title: Setting string equal to match found by Rails regex
body: <p>I'm trying to pull the user_id from a foursquare URL, like this one:</p>
  
  <pre><code> https://foursquare.com/user/99999999
  </code></pre>
  
  <p>The following regex pulls exactly what I need (a series of numbers that terminate with the end of the line):</p>
  
  <pre><code>\d+$
  </code></pre>
  
  <p>However, I'm not sure how to set a string equal to the matched characters. I'm aware of sub and gsub, but those methods substitute a matched string for something else.</p>
  
  <p>I'm looking for a way to specifically pull the section of a string that matches my regex (if it exists)</p>