Using Powershell, I'm trying to remove leading zeros of the numeric part of a string. Here are a couple of examples and expected results:
AB012 needs to become AB12
ABC010 needs to become ABC10
I've tried the following, but it gets rid of all zeros. How can I tell it to only remove the leading zeros? The format of the string will always be letters followed by numbers. However, the length of the letters may vary.
$x = ABC010
$y = $x -replace '[0]'
$y
This will display ABC1, and I wish to display ABC10.
Thanks.