> What if I want to have just those matched numbers?
You can access what's been matched by your entire pattern with $matches[0]
Quote:
> Later on I'd like to convert it to a number so if it's
I spent ages trying to figure out how to do this. It seemed odd to me that
you can conver a number to a string using .tostring but can't convert a
string to a number using .tonumber (no such thing). Instead, do this:
$i = "00001"
$numeric_i = [int] $i
Mike
"Jarod" <Jarod@xxxxxx> wrote in message
news:0FC1C754-9CAE-4F4F-A4F0-F83EE1564E09@xxxxxx
Quote:
> Hi!
>
> When I do:
>
>
> dir | where { $_.Name -match "\d+" }
>
> It displays names containing numbers.
> What if I want to have just those matched numbers?
>
> So if the file name is : powerShell_01.txt
> I want to have this 01 how to get this?
>
> Later on I'd like to convert it to a number so if it's
> 0001 or 001 or 000001 it's just 1.
>
> and rename files 
>
> Thx for help with this.
>
> Jedrzej
>