title: Extract integer from powershell string
body: <p>I need to extract a number from a string, the number changes all the time so cannot just be hard coded eg:</p>
  
  <pre>some random amount of text 54321 more text and another number 123</pre>
  
  <p>I know I can use something like:</p>
  
  <pre><code>'john123456smith' -replace "[^0-9]" , ''
  </code></pre>
  
  <p>but that gives me <code>54321123</code> which is not what I want, I only want the <code>54321</code>.</p>
  
  <p>Any idea on a regular expression that will do that?</p>