title: R: regex to grep all first occurrence of percentage ([0-9]*%)
body: <pre><code>string &lt;- c("50% something", "something100% more", "Both6% and also60%")
  </code></pre>
  
  <p>I cannot figure how to get the first occurrence of the number before '%'. Note that all sorts of characters can occur in <code>string</code>. My result from <code>string</code> above would be:</p>
  
  <pre><code>[1]  50 100   6
  </code></pre>