title: Extract a substring from a string in Ruby using a regular expression
body: <p>How can I extract a substring from within a string in Ruby?</p>
  
  <p>Example:</p>
  
  <pre><code>String1 = "&lt;name&gt; &lt;substring&gt;"
  </code></pre>
  
  <p>I want to extract <code>substring</code> from <code>String1</code> (i.e. everything within the last occurrence of <code>&lt;</code> and <code>&gt;</code>).</p>