 <p>With PowerShell you're likely to find many different ways to do the same thing. Here's a way to do this as one-liner:</p> <pre><code>PS&gt; 'Tom1Jerry02','abcd0asdf001','qwerty1' | Foreach {if ($_ -match '(\d+)$') {$matches[1]}} 02 001 1 </code></pre>